Lisp In A Box - 为什么要启动服务器?
我决定重新学习 LISP(自从我的 AI 课程以来就没有使用过它),以便更熟悉一般的函数式编程,所以我下载了 Lisp In A Box(我们在之前的课程中实际使用过),它附带了CLISP 和 Emacs。
当我运行它时,它说:
已连接到端口 1617。兄弟,拿走这个 REPL,希望它能很好地为您服务。
什么? 所以我更仔细地查看了 Lisp In A Box 网页,发现了这个:
SLIME 是 Emacs 的集成开发环境,它通过网络套接字与 Common Lisp 实现交互。 有关 SLIME 的大量信息可以在 CLiki 上的 SLIME 节点找到。 SLIME 手册以 PDF 格式在线提供。
我有点理解 SLIME 是什么(emacs 的某种扩展,对吧?)但是为什么文本编辑器要启动自己的服务器并连接到它呢?
I've decided to get back into LISP (haven't used it since my AI classes) to get more comfortable with functional programming in general, so I downloaded Lisp In A Box (which we actually used in a previous class) which comes with CLISP and Emacs.
When I run it, it says:
Connected on port 1617. Take this REPL, brother, and may it serve you well.
What the? So I looked on the Lisp In A Box webpage more closely and found this:
SLIME is an integrated development environment for Emacs which interfaces with a Common Lisp implementation over a network socket. Lots of information about SLIME can be found at the SLIME node on CLiki. The manual for SLIME is available in PDF format online.
I somewhat understand what SLIME is (some sort of extension to emacs, right?) But why in the world is a text editor starting its own server and connecting to it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
目的是让 Lisp 能够并行运行。
Slime 连接到会话,然后您可以从许多不同的窗口(甚至机器)获得相同的环境、定义等。 例如,这意味着您可以启动应用程序并即时调试它。
有关更多信息,请查看此博客。
The purpose is so that Lisp will be running in parallel.
Slime connects to the session and then you can have the same environment, definitions, etc from many different windows (or machines even). This means that you can start up your application and debug it on the fly, for instance.
For further information, look at this blog.
插座比管道更灵活。 其一,SLIME 允许您连接到网络上的 Swank 服务器,这对于在具有长时间运行进程的远程计算机(例如 Web 服务器)上进行实时修复非常有用。 鉴于此,为什么要通过以支持管道和套接字的方式抽象通信来增加另一层复杂性? 无论如何,管道的编程并不比套接字简单。
Sockets are more flexible than pipes. For one, SLIME lets you connect to Swank servers on the network, which is very useful for doing live fixes on remote machines with long-running processes (such as web servers). Given this, why would you add another layer of complexity by abstracting communication in such a way as to support both pipes and sockets? It's not like pipes are any simpler to program than sockets, anyway.
那么,Slime 启动 Lisp 进程来为您提供集成开发环境。 这样您就可以动态测试和调试代码,并且还能够检查对象。
我认为选择带有套接字的架构是为了在不同的 lisp 之间提供更好的可移植性(顺便说一句,Slime 还支持 Clojure 和 MIT计划 )和OS-es(Slime也适用于Windows)。 它还允许跨平台开发 - 您可以从 Emacs 在目标架构上测试您的软件。
所以我认为,这个决定很棒,你只是不应该将 swank (Slime 后端)放在生产服务器上。
Well, Slime starts Lisp process to give you integrated development environment. So that you can test and debug your code on the fly and also be able to inspect objects.
I think architecture with sockets was chosen for better portability between different lisps (Btw, Slime also supports Clojure and MIT Scheme ) and OS-es (Slime works on Windows too). Also it allows cross-platform development - you can test your software on target architecture from your Emacs.
So I think, that this decision is great, you just should not put swank (Slime back-end) on production servers.
您将获得并行运行的 REPL(读取-评估-打印-循环),以便您可以从编辑器即时编译和测试代码片段。 《Practical Common Lisp》(网上免费提供)对此有很好的解释,是一本非常好的学习 Lisp 的书。
You get a REPL (read-evaluate-print-loop) running in parallel, so that you can compile and test code snippets on the fly from your editor. "Practical Common Lisp" (freely available on the web) has a good explanation for this, and it is a very good book for learning Lisp.