Dear World,
Pharo 4.0 is here!
Pharo is a pure object-oriented programming language and a powerful environment, focused on simplicity and immediate feedback.
Many things have changed in Pharo. Here are some highlights:
- Inspector/Playground/Spotter are new moldable development tools for inspecting, coding and searching objects.
- Slots model instance variables as first class entities and enable meta-programming on this level.
- ShoreLine reporter introduces a way to report system errors and collect statistics, that we will use for future improvements
- Dark theme.
These are just the more prominent highlights, but the details are just as important. We have closed 1700 issues in Pharo 4. Take a moment to go through a more detailed recount of the progress: ChangeLogs.
Pharo is improving on many fronts, but one of the most prominent changes is the addition of moldable tools for inspection and search. These tools provide extension mechanisms that allow every object to define ways in which it can be understood effectively. To provide an idea of the impact of the already existing extensions, the map below shows the Pharo classes grouped in packages, highlighting in red those parts of the system that have at least one such custom view coming with the main distribution. The spread of these extensions shows that moldability is powerful mechanism that can be used in many contexts.
Remember that Pharo is your platform. We thank all the contributors of this release:
Clara Allende, Jean-Baptiste Arnaud, Jean-Christophe Bach, Philippe Back, Clement Bera, Alexandre Bergel, Torsten Bergmann, Vincent Blondeau, Noury Bouraqadi, Santiago Bragagnolo, Johan Brichau, Sven Van Caekenberghe, Damien Cassou, Nicolas Cellier, Guido Chari, Dimitris Chloupis, Andrei Chis, Ben Coman, Bernardo Contreras, Tommaso Dal Sasso, Jan Van De Sandt, Christophe Demarey, Sean DeNigris, Marcus Denker, Martin Dias, Stephane Ducasse, Stephan Eggermont, Luc Fabresse, Johan Fabry, Hilaire Fernandes, Jerome Garcia, Tudor Girba, Thierry Goubier, Jigyasa Grover, Kris Gybels, Norbert Hartl, Dale Henrichs, Pablo Herrero, Nicolai Hess, Pavel Krivanek, Juraj Kubelka, Jan Kurs, Laurent Laffont, Jannik Laval, Kevin Lanvin, Max Leske, David Lewis, Diego Lont, Esteban Lorenzano, Tim Mackinnon, Attila Magyar, Esteban Maringolo, Stefan Marr, Max Mattone, Martin Mc Clure, Eliot Miranda, Alain Plantec, Guillermo Polito, Damien Pollet, Stefan Reichhart, Mark Rizun, Udo Schneider, Ignacio Sniechowski, Henrik Sperre Johansen, Igor Stasenko, Aliaksei Syrel, Ciprian Teodorov, Camille Teruel, Sebastian Tleye, Yuriy Tymchuk, Peter Uhnak, Andres Valloud, Sven Van Caekenberghe, Thomas Vincent, Jan Vrany, Martin Walk, Richard Wettel, Dmitri Zagidulin
And all those who contributed indirectly, by reporting bugs, participating in discussion threads and providing feedback.
Pharo 4.0 is another big step. And, the best is yet to come.
Enjoy!
The Pharo Team
In Pharo, String>>asClass
is a scripting convenience method that looks up a class based on its name. While in scripts it can be tolerated, using it in production code is an anti-pattern.
Stephane recently pointed out that some classes already exist in Glamour that make use of #asClass. For example:
GLMBrickStructureTrait>>openInBrickWindowLabeled: aLabel
#GLMSystemWindowBrick asClassIfAbsent: [
^ self asMorph openInWindow ].
^ #GLMSystemWindowBrick asClass new
...
openCenteredInWorld
This code should clearly not exist, but this is not what this post is about. The question is, how can we quickly find out where is String>>asClass
used inside Glamour.
Let’s use Spotter. We start from finding the String>>asClass
method.
We dive in (Cmd+RightArrow):
We see that there are 10 senders. To find those that are in Glamour, we simply filter by the GLM
prefix:
Quick and easy.
Humane assessment was just featured in a short article entitled "Tooling the software engineering decision making process" on productdevelopmentsuccess.com.
GTInspector enables fine-grained interaction with objects, but it is less tuned to quick searching within the context of the object. At the same time, GTSpotter allows you to quickly search for objects.
It is only natural to link the two. We already have a way to get from GTSpotter to GTInspector as the default action in GTSpotter is to inspect. For example, suppose you inspect a directory.
While, the inspector already allows you to navigate through folders, it is often more convenient to dive through the file system with GTSpotter. To achieve this, you would need to jump from inspector to spotter.
In our example, as the FileReference
class already offers spotter extensions, the inspector offers a magnifier glass icon on the top right. Clicking that icon triggers an instance of GTSpotter that is scoped to our FileReference
object.
From here, GTSpotter works as expected with full diving and previewing possibilities.
As the default action is inspection, pressing Enter on a file or directory opens an inspector on that object.
The integration is far from perfect. For example, at the end of the interaction you end up with two windows (one for the initial Playground, and one for the Inspector) without any casual connection between the two. Nevertheless, this is a cheap extension that allows you to leverage the power of GTSpotter for any object.
When we introduced GTSpotter, searching for files was one of the featured use cases. In this post, we take a closer look at how GTSpotter makes reaching out to various parts of the file system seamlessly integrated in Pharo.
Diving into folders
The first prerequisite for dealing with the file system is that of navigating through it. The diving mechanism of GTSpotter lends itself nicely for this purpose.
For example, searching in the current folder allows you to find a folder of interest. The preview to the right shows the contents.
Diving into it (using Cmd+Shift+Right), reveals the contents in the main window and enables further navigation.
Previewing files
The GTSpotter preview obviously allows you to take a peek not only in the contents of a folder, but also into the contents of files. For example, a text file will be shown as text.
Or a Pharo script file will be shown with proper syntax highlighting.
Relative and absolute paths
While the diving mechanism allows you to scope our search for a folder, it is also possible to enter a full path directly in the top search. Previously, we saw how starting the search with ./
triggers a search in the working directory. Adding another separator, like seen below, allows you to search through nested folders without diving.
And this works with arbitrary amount of nesting.
Of course, searching can also be triggered by the full path. This is particularly convenient when pasting a full path copied from somewhere else.
While the examples shown here work with Unix-like paths, when on Windows, GTSpotter will deal equally well with Windows paths such as .example
or c:example
.
Diving into zip files
One particular situation that often breaks the flow of navigation in file system tools is that of dealing with archives. Pharo comes with an off-the-shelf library that maps Zip files onto file systems, and GTSpotter takes advantage of that. For example, when selecting a Zip file, the preview shows the contents.
Diving into the file, opens the Zip archive virtually and shows its contents as if it were a plain folder. Diving and previewing works as expected.
And this includes diving into zip files nested in other zip files.
Summary
GTSpotter makes the file system easily browse-able from inside a Pharo image. Combine this with the detailed interactions offered by the GTInspector and you will transform Pharo into a powerful file system manipulation environment.