[Pharo-project] Misc. newbie questions

Frank Shearar frank.shearar at gmail.com
Sun Jan 8 12:35:24 CET 2012

2012/1/8 Göran Krampe <goran at krampe.se>:
> On 01/08/2012 02:05 AM, Gerry Weaver wrote:
>> Hello All,
>> Thank you for all of your responses. They are really helping me get a
>> better picture of Pharo, the environment, and the community.
>> I really like the idea of a REPL type interface. If I understand
>> correctly, all of the functionality that deals with class/method definition
>> is already there. It seems like it would be a matter of writing a little
>> server type application that would communicate via stdin/stdout. I assume
>> one could then send messages to the code that evaluates methods/function
>> definitions and provide result feedback via stdout. Maybe it could also
>> understand some commands like doit and accept. It could be interesting to
>> have a TCP based interface as well. How difficult would it be to do
>> something like this? I may start looking into this. It seems like a good
>> project to jump into the deep end, start paddling, and drinking a little
>> water (hopefully not too much). Is the code that handles this kind of thing
>> readily accessible? I've started looking around a bit.

http://lists.gforge.inria.fr/mailman/listinfo/pharo-coral <-- not
TCP-based, but it should be trivial to extend it to use a socket
instead of stdin/out

> The answer is that it is basically trivial to do and many people have
> already done it in various forms - I even did a TCP server for Joe Armstrong
> (one of the creators of Erlang) that does similar things:
> http://www.squeaksource.com/JoesServer.html
> ...BUT... when it comes to Joe he wanted to use Squeak from Erlang in order
> to dynamically create UIs etc. So he had a reasonable use case. ;)
> ...if you just happe to "like REPLs" then you should really try to use and
> learn the Squeak/Pharo IDE. Think of it as a full blown live graphic REPL
> with tons of cool tools. Every text area in Pharo/Squeak is a "REPL" anyway.

You should definitely learn to use the Squeak/Pharo IDE, even apart
from the fact that it's the least rubbish way of writing code. The
Workspace is, fair enough, a bit like a REPL. Well, no, it IS a REPL.
It's just a REPL that requires you to use a GUI.

The complicated part of a Smalltalk REPL is Smalltalk's syntax: it's
designed to work at the method level, where some code-holding widget's
entire contents holds a single method. This is why Coral and GNU
Smalltalk alter the core syntax a bit, to allow marking the start and
end of a method. For instance, gst has something like

Foo extend [
  bar [
    ^ 'return!'

to add a method #bar to an existing class Foo.

(Or: Smalltalk syntax has no "this is the end of a method" marker,
beyond the _optional_ ^ statement.)


> regards, Göran

More information about the Pharo-project mailing list