How does class organization in categories and packages work in different versions of Pharo?

Can someone explain how class organization in Pharo works in different versions of Pharo?

  • All classes are part of Smalltalk global (have always seemed to remain so?)
  • Classes may have a category, but is it just a kind of tag? (It always seems that way? But the categories are sometimes somehow displayed on the packages?)
  • There are different types of packages in different versions of Pharo
    • MCP packages representing Monticello packages.
    • PackageInfo
    • RPackage (Pharo 1.4)?

Also, is there SystemNavigation that somehow helps navigate through classes and methods based on some of the above constructs?

+6
source share
2 answers

Classes

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

Class Categories

A class category is very similar to a tag. A class can only be in one category at a time. The class category was originally used by Browser to organize classes in the system.

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

PackageInfo does all the hard work: finding classes and free methods related to the package.

MCPackage is a Monticello-specific wrapper for PackageInfo , which adds some protocol that is not necessarily suitable for the more general PackageInfo .

Packages

Overloading the class category for package membership was a neat trick that made Monticello easier to accept (existing development tools did not need Monticello to learn), but it is still a trick . Not to mention that the implementation of PackageInfo was not very efficient.

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

Both package implementations will continue to exist until PackageInfo is canceled.

Systemnavigation

As Frank says,

SystemNavigation is a class that, as its name implies, makes it easy to query several different things: classes in the image, senders, developers, information about packages loaded into images, etc.

+5
source

Classes are currently at least keys in the Smalltalk dictionary.

PackageInfo contains information about grouping classes and extensions for other packages.

The Monticello package contains a deployable code unit. Usually one of them will correspond to an instance of PackageInfo . (For example, clicking the "+ Package" button in the Monticello browser will create one of them.) The Monticello package may contain pre-load scripts even after loading, so the two classes perform separate functions if appropriate.

SystemNavigation is a class that, as its name implies, makes it easy to request many different things: classes in the image, senders, developers, information about packages loaded in the image, etc.

+4
source

Source: https://habr.com/ru/post/918649/


All Articles