4 ms·
In Smalltalk, the class browser (editor) has always been the REPL. You can highlight any snippet of code you browse, including code you're currently editing, an
by pharo70 9y ago
In Smalltalk, the class browser (editor) has always been the REPL. You can highlight any snippet of code you browse, including code you're currently editing, and evaluate it in the context of whatever class you're browsing.
For example, if you're editing a method called "fooBar", you can just type (in the same input field) "self new fooBar" ("self" is bound to the class being browsed) or, if it's a class method, "self fooBar", highlight it, and then type the appropriate shortcut (like Cmd+d in Pharo) to evaluate it.
This is useful for documentation. You can have a method begin with a comment that shows examples, which a person browsing can highlight and evaluate, and also experiment with.
- lispm 9y agoBut that's not really a REPL. It lacks the 'L' and often also the 'P'. Running code from a text buffer in an editor is one way to interact (many Lisp tools do that), but a REPL is usually a tool and its purpose is to read expressions, evaluate them and print the results. I would be surprised, if Smalltalk did not have that somewhere, too. The REPL has a visible I/O history and is not conflated with other text input fields (like a function being edited).
- pjmlp 9y agoThe 'P' is just another entry on the Smalltalk menu options. One can choose to evaluate, or evaluate and print. The 'L' is the whole Smalltalk environment, as anything that changes the environment is kept in memory or saved along the image on exit. A Lisp like REPL is available as Transcript windows.
- lispm 9y agoThe output goes into the text field where I'm editing. That's not a REPL. Usually printing output to a random text field makes no sense. It can make sense to execute commented code snippets in code, or evaluate code and have the result being inserted. A transcript window is usually a text output window, more like a console output. I'd say the Workspace window is slightly similar to a REPL. But it still does not work like the usual Lisp REPL, where you type to the tool usually textually at the bottom and get the result displayed there. With Smalltalk I usually type to an editor Workspace window and REPL I/O does not need to have a sequential order.
- pharo70 9y ago> But that's not really a REPL. It lacks the 'L' and often also the 'P'. This objection is subtle. The "P" in REPL of course does not simply mean to emit some printed representation of the result of the last evaluation, but to emit a specific representation that a corresponding operation, (read), can comprehend. In that sense, no non-Lisp, including Pharo, has a true "P" and a true REPL. (Though many objects in Pharo do have such printed representations). > Running code from a text buffer in an editor is one way to interact (many Lisp tools do that), Like Emacs and SLIME. But having used both, I prefer the Smalltalk browser-based IDE approach. The browser makes code navigation much easier, and it saves you from having to type out a lot of class and method creation boilerplate code like the kind you end up writing when using Emacs and CLOS. Maybe LispWorks (which I've never used) is that kind of IDE, but for CL? > I would be surprised, if Smalltalk did not have that somewhere, too. The REPL has a visible I/O history and is not conflated with other text input fields (like a function being edited). Repeatedly print-evaluating (Cmd+P in Pharo) code in a workspace/playground is actually the closest I think most Smalltalks come. A command prompt-style REPL isn't as useful in a fully graphical environment. You could easily create one if you wanted, though, and text-based Smalltalks like Gnu and Amber have one. However, the inspector in Pharo can function as a nice graphical REPL. You can enter code in an inspector pane, evaluate it with Cmd+G, and the result will appear in a new inspector pane to the right of the current, and you can cycle back and forth through evaluation panes.
- lispm 9y ago> but to emit a specific representation that a corresponding operation, (read), can comprehend. On the Symbolics Lisp Machine they then added a facility where READ can read arbitrary things, since each thing you PRINT has a printed representation/view, which stays connected with the original object. Thus you can enter non-text things or non-printable things in a REPL. > Maybe LispWorks (which I've never used) is that kind of IDE, but for CL? Not really, it is not browser based in the sense of Smalltalk. It has browsers for things like classes, but you do no in-place editing. Apple Dylan or Interlisp-D were that way. Interlisp-D is a similar managed source system like Smalltalk, but with Lisp representations and structure editing. > However, the inspector in Pharo can function as a nice graphical REPL. You can enter code in an inspector pane, evaluate it with Cmd+G, and the result will appear in a new inspector pane to the right of the current, and you can cycle back and forth through evaluation panes. LispWorks has something where you have a REPL and an inspector in a window. Each evaluation result in the REPL goes into the inspector and you can cycle between inspected values back and forth. One can also link windows in LispWorks, for example a REPL with an inspector.