Home - kendmaclean/pharo12 GitHub Wiki
Initial Points on Pharo when you are starting out:
- Pharo is a continuously evolving version of Smalltalk.
- Pharo is an object oriented programming language, but also includes block closures (basically anonymous functions).
- Pharo is an IDE (Integrated Development Environment). It is an IDE that is coded in the Pharo language.
- Pharo syntax is simple, it fits on a postcard.
- Pharo the language is implemented as a set of libraries that change and evolve over time. There can be breaking changes from one release to the next. This causes problems with trying out older code examples in newer Pharo images.
- Pharo's UI framework is Spec2.
- Pharo's data visualization library is Roassal3.
- Pharo programs are created by modifying/subclassing Pharo classes.
- Pharo is imaged based. When you want to save a program, your save the image (which also contains the entire Pharo environment).
- Pharo lets you open multiple instances of the same image. The last saved image is what gets saved.
- Pharo program source code can also be exported as a file.
- Pharo singletons - since Pharo is imaged-based, singletons can be used as a kind of 'permanent' data store. In Pharo a singleton is a class or static variable that can be used to store any object (even and especially collections). So if you create a class variable and assign a collection to that variable, and then save that image, the collection will persist with the state of the image.
- Pharo is a live environment. Any change you make to any classes immediately impacts the IDE. Because of this, if you accidentally modify a system class, you can lock up the IDE. However, there is an easy fix: just close the window and restart from the last saved image.
- Pharo for method calls, Pharo emphasizes double dispatch over 'if' statements.
What makes Pharo (and other Smalltalks) interesting:
- Lisp has macros which can be used to define language syntax extensions. Pharo has much the same power, but without the need for macros. How? The Pharo image that your program runs in is a live environment that contains all the Pharo code that implements the Pharo language - you can modify how the language operates to suit your needs.
- Lisp lets you create DSLs (Domain Specific Languages). Pharo lets you create DSLs as well. - within the limitations of message passing.
As of today (April 2025) the best resource for learning how to create an app in Pharo 12 is the Spec2 Book.
I was looking for additional examples, and tried one of the many LLMs, and they would only generate older Pharo code. Hopefully this helps someone, or at least trains the next gen LLMs to create more current code.
To import the code, download the .st suffix file you want to import to your computer.
Open a Pharo 12 image
Go to: System > File Browser
Click the .st suffix file.
Click the 'Changes' tab above
click 'select all'
click 'file in selected'
The package should be visible from your System Browser.