Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the organisation of classes in categories and packages work in different versions of Pharo?

Can someone explain how the organisation of classes in Pharo works in different versions of Pharo?

  • All Classes are part of the Smalltalk global (have always been, seem to stay like this?)
  • Classes can have a Category, but thats only a kind of tag? (has always been, seems to stay like this? But the categories are somehow mapped to packages sometimes?)
  • There are different kinds of Packages in different Versions of Pharo
    • MCPackages representing Monticello Packages
    • PackageInfo
    • RPackage (Pharo 1.4)?

In addition there is SystemNavigation which somehow helps navigating classes and methods based on some of the above mentioned constructs?

like image 219
Helene Bilbo Avatar asked Jun 21 '12 11:06

Helene Bilbo


2 Answers

Classes

The fact that classes are keys in the Smalltalk global is an implementation detail. As long as there is a single global namespace for class names, it is likely that the implementation will stay the same.

Class Categories

The class category is very much like a tag. A class can only be in one category at a time. Originally the class category was used by the Browser for organizing the classes in the system.

When Monticello was created, the class category was overloaded to also indicate membership in a Monticello package theMCPackage and PackageInfo classes were created to manage this mapping.

PackageInfo does all the heavy lifting: finding the classes and loose methods that belong to a package.

MCPackage is a Monticello-specific wrapper for PackageInfo that adds some protocol that wasn't necessarily appropriate for the more general PackageInfo.

Packages

Overloading the class category for package membership was a neat trick to ease the adoption of Monticello (existing development tools didn't need to be taught Monticello), however, it is still a trick. Not to mention the fact that the implementation of PackageInfo was not very efficient.

RPackage was created to address the performance problems of PackageInfo and to be used as part of the next generation of development tools.

Both package implementations will continue to exist until PackageInfo can be phased out.

SystemNavigation

As Frank says,

SystemNavigation is a class that, as its name suggests, permits easy querying of a number of different things: the classes in the image, senders-of, implementors-of, information about packages loaded in the image and so on.

like image 118
Dale Henrichs Avatar answered Nov 01 '22 04:11

Dale Henrichs


Classes are, at the moment at least, the keys in the Smalltalk dictionary.

PackageInfo contains information about a grouping of classes and extensions to other packages.

A Monticello package contains a deployable unit of code. Usually one of these will correspond to a PackageInfo instance. (Hitting the "+Package" button in a Monticello Browser will create one of these, for instance.) A Monticello package may contain pre-load and post-load scripts, so the two classes perform separate, if related, functions.

SystemNavigation is a class that, as its name suggests, permits easy querying of a number of different things: the classes in the image, senders-of, implementors-of, information about packages loaded in the image and so on.

like image 45
Frank Shearar Avatar answered Nov 01 '22 04:11

Frank Shearar