pharo-project / pharo

Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk.
http://pharo.org
Other
1.21k stars 356 forks source link

[Feature Request] SystemBrowser should support custom environments #14387

Open astares opened 1 year ago

astares commented 1 year ago

In Pharo 11/12 every class now has an environment (which by default is the Smalltalk system dictionary). Pharo typically also has an own package organizer holding all packages. By default the system browser (Calypso) opens on both: to let you browse packages, classes and methods of the standard Pharo environment.

Now with Pharo Bootstrap and projects like TinyBootstrap from @ErikOnBike it is possible to create and build own images (reflecting an own custom environment) and it would be nice if this could be done in the future directly from within Pharo using the standard Pharo tools like Calypso and Iceberg.

For this the Calypso standard browser must allow to browse and manipulate such an own custom environment. But it looks like Calypso is still not able to browse and manipulate such an own environment in full.

There are already classes like ClySystemEnvironment and ClySystemEnvironment in the Calypso framework to make the browser independent and one can try out the following code in a playground:

organizer := RPackageOrganizer new.           "an own organizer"
environment := Object environment class new.  "an own environment"
announcer := SystemAnnouncer uniqueInstance. 

systemEnvironment := ClySystemEnvironment new
            name: 'My own environment';
            globals: environment;
            packageOrganizer: organizer;
            changesAnnouncer: announcer.

navigationEnvironment := ClyNavigationEnvironment overSystemEnvironment: systemEnvironment.

"Open the browser"
ClyFullBrowserMorph openOn: navigationEnvironment 

This opens a new empty browser on a fresh clean environment and one can add a new package. The package also correctly ends up in the own organizer instance - but it is not shown in the browser. To show it one has to reopen the browser:

ClyFullBrowserMorph openOn: navigationEnvironment

Also when a class is created in this environment scoped browser window it does not really end up in the new environment - but still in the old Pharo environment.

If the browser would update and compilation would be done into the environment that is currently opened and browsed this would be helpful towards the building of own custom images right from within a standard image.

astares commented 1 year ago
image