Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lisp In A Box - Why is it starting a server?

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?

like image 825
Cybis Avatar asked Nov 21 '08 16:11

Cybis


3 Answers

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.

like image 60
dsm Avatar answered Nov 09 '22 01:11

dsm


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.

like image 36
Matthias Benkard Avatar answered Nov 09 '22 01:11

Matthias Benkard


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.

like image 2
Anton Nazarov Avatar answered Nov 08 '22 23:11

Anton Nazarov