What's so inferior about inferior-lisp?
Asked Answered
J

2

15

As I've started learning about lisp, emacs, and ess (Emacs Speaks Statistics), I've come across this concept of inferior-this-or-that. For instance, there's an inferior-ess-mode, inferior-lisp, and Inferior Emacs Lisp Mode.

In all these cases, it seems that some interpreted language is running within emacs, and you can interact with it within a buffer. But why are they inferior and what are they inferior to?

Jinajingle answered 10/8, 2014 at 3:2 Comment(1)
It's inferior in the sense that you're inferior to your superiors. It's not a qualitative term; it refers the fact that the inferior process is managed by the superior process, "reports" to the superior processes, and "receives tasking" from the superior process.Officeholder
N
13

An inferior mode refers to a mode which run as a subprocess of emacs.

For example, this is my process tree when I start emacs:

$ pstree 62238
--= 62238 smt /usr/local/Cellar/emacs/HEAD/Emacs.app/Contents/MacOS/Emacs

After I run an inferior tcl shell, this is what my process tree looks like:

$ pstree 62238
-+= 62238 smt /usr/local/Cellar/emacs/HEAD/Emacs.app/Contents/MacOS/Emacs
 \-+= 62359 smt /bin/sh /usr/bin/wish
   \--- 62361 smt /usr/bin/../../System/Library/Frameworks/Tk.framework/Version

Another way of saying this might be that "inferior" is synonymous with the prefix "sub-" in this context.

Negotiate answered 10/8, 2014 at 3:58 Comment(0)
F
8

I think the Inferior Emacs Lisp Mode (ielm) is a wrong name. That should be named Interactive Emacs Lisp Mode. With ielm Emacs Lisp is not running as an inferior Lisp. It is a read eval print loop for the built-in Emacs Lisp. GNU Emacs really names it Inferior Emacs Lisp Mode, but if you look at the sources, it uses directly the built-in Emacs Lisp eval to evaluate the expressions. It just reuses some infrastructure (comint) for dealing with inferior interpreters (like Lisps, shells, ...).

Generally Inferior Lisp means that it is a (often external) Lisp system under control from Emacs. It also does not need to be Emacs Lisp. Usually it is some other Lisp dialect like Common Lisp. Common Lisp has/had several extensions to Emacs and Common Lisp, so that it runs as an inferior Lisp with a lot of functionality of a Lisp development environment (debugger, inspector, source locator, ...):

  • ILISP (Inferior Lisp), outdated
  • ELI (Emacs-Lisp Interface), from Franz, Inc. for Allegro CL
  • SLIME (Superior Lisp Interaction Mode for Emacs)
  • SLY (Sylvester the Cat’s Common Lisp IDE)

Emacs also has a simple built-in facility for running an inferior Lisp: External Lisp.

  • inferior-ess-mode: controls a R subprocess
  • inferior-lisp: a Lisp subprocess
  • inferior-emacs-lisp-mode: the built-in Emacs Lisp as a read eval print loop
Follmer answered 10/8, 2014 at 8:57 Comment(5)
There is lisp-interaction-mode already, which is used in *Scratch*. In case of IELM, “Inferior” refers to running via Comint Mode, which is what all “Inferior” modes (i.e. Inferior Haskell Mode) do, so that's really the distinctive feature of IELM. Lisp Interaction Mode offers a quite different style of interpreting Emacs Lisp.Hautegaronne
lunaryorn: lisp-interaction-mode also uses the built-in Emacs Lisp. Neither it nor ielm are using an inferior Lisp.Follmer
Being built upon Comint, IELM looks like an “inferior” interpreter, for all purposes and intents. “Interactive” does not sufficiently describe the distinctive feature of IELM, compared to Lisp Interaction Mode. In the end, M-: is “interactive” as well. All of Emacs is essentially an interactive Emacs Lisp environment.lHautegaronne
lunaryorn: it may look like an Inferior Lisp, but it does not behave as such. For example if Emacs Lisp code is executed, Emacs is completely unresponsive. Changes are to the local Emacs, etc - which means redefining an Emacs Lisp function may crash the editor, setting variables may have effects on the editor, ...Follmer
An obligatory mention of Sly as an alternative to SLIME.Logging

© 2022 - 2024 — McMap. All rights reserved.