HN user

pharo70

26 karma
Posts0
Comments3
View on HN
No posts found.

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.

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.