Pharo is an open source implementation of the programming language and environment Smalltalk. Pharo emerged as a fork of Squeak, an open source Smalltalk environment created by the Smalltalk-80 team. This article explores how to use Pharo to learn Smalltalk, using Pharo unique package management tools and running Pharo on Raspberry Pi.
Inria is the company who produce Pharo and many related software anaysis tool. You can find the list here:
Pharo Video Tutorial
Here are some recommended Pharo learning tutorials:
Pharo team produced an excellent free book, that you can download from here:
- Tudor Girba - Pharo: Playing with Live Object (where AtomMorph demo are showing)
- Laurent Laffont - Manipulating Objects (where AtomMorph demo are showing; this video is technical details)
Pharo is the cool new kid on the object-oriented languages arena. It is Smalltalk-inspired. It is dynamic. It comes with a live programming environment in which objects are at the center. And, it is tiny. But, most of all, it makes serious programming fun by challenging almost everything that got to be popular. For example, imagine an environment in which you can extend Object, modify the compiler, customize object the inspector, or even build your own the domain-specific debugger. And, you do not even have to stop the system while doing that.
Tons of packages can be found at:
After finding what you like, you can use Monticello Browser to add the package.
The repository can be added, for example
Demo with BouncingAtomsMorph
The tutorial steps on using AtomMorph Demo are repeated here. For a newcomer on learning Smalltalk, this AtomMorph Demo illustrates many amazing features of the Smalltalk dynamic nature and it’s development environment.
- BouncingAtomsMorph new openInWorld
- meta-click>open explorer
- select some submorphs>AtomMorph and inspect it
- self color: Color red
- self velocity: 0@0
- drag out the red AtomMorph
- make it larger
- copy it
- inspect it
- self velocity: 2@3
- drag it back to the BouncingAtomsMorph
- click on the red Menu handle and embed it
- self browse the AtomMorph
- browse velocity:
- browse senders of velocity: -> browse #bounceIn:
- modify to beep after bounce:
- very noisy, so add test for color red
- create a subclass of AtomMorph with a different color that beeps
- define BeepingAtomMorph
- BeepingAtomMorph new openInWorld
- instantiate it and embed it
- find senders of bounceIn:
- see BouncingAtomMorph»step tests AtomMorph class
- we can change BouncingAtomMorph»step or BeepingAtomMorph as follows:
Show all Morph Instances
Remove all Morph Inspect BoundingAtomsMorph object and execute,
Metacello is a package management system for Monticello (a versioning system used in Smalltalk). There is a chapter about Metacello in the “Deep into Pharo” book, and it gives a good in-depth knowledge about this system. On the other hand when I was starting to use Metacello, I needed something more simple and direct, like what I described here.
In Pharo, Metacello is presented as Configuration Browser, which you can use to easily install more packages.
|Roassal2||Roassal graphically renders objects using short and expressive Smalltalk expressions. A large set of interaction are offered for a better user experience. Painting, brushing, interconnecting, zooming, drag and dropping will just make you more intimate with any arbitrary object model. Documentation is here Roassal2 Documentation|
|NeoCSV||CSV (Comma Separated Values) and more generally other delimiter-separated-value formats like TSV are probably the most common data exchange format. A number of implementations of this simple format already exist. NeoCSV is a more flexible and more efficient reader and writer for this format. Documentataion is here NeoCSV Paper|
Pharo running on Raspberry Pi
For Raspberry Pi lover, of course we can run Pharo on it. The easy way is to download the precompiled result at: Precompiled Raspberry Pi Pharo Image
If you are hardcore Pi-er, you wanted to do it yourselves. You can explore this link: Compile Pharo by Hand
After you have the compiled Pharo image, copy to a Raspberry Pi, let’s say folder named Pi_Pharo. Here is a picture showing Pharo is running on Raspberry Pi via VNC viewer.
That’s all for now, have fun learning Smalltalk!