[squeak-dev] Nested Environments demo

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Wed Apr 7 15:42:50 UTC 2021


Very cool implementation, Tony! I admit that I did not watch the entire video, but what I could see from the screenshots looks great. It feels kind of something that has always been missing in Smalltalk for eternities.


How large is your entire patch? Provided it's not huge, I would vote for introducing these changes into the Trunk.


Best,

Christoph

________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Tony Garnock-Jones <tonyg at leastfixedpoint.com>
Gesendet: Dienstag, 30. März 2021 14:12:45
An: The general-purpose Squeak developers list
Betreff: [squeak-dev] Nested Environments demo

Hi all,

I recorded a little screencast of the EnvironmentBrowser I've been
playing with:

https://www.youtube.com/watch?v=1UOyca5-72Y

it's ~11 minutes long if you watch it at 1:1. In the description of the
video is the outline that I was following as I recorded the talk.

I'll paste it below as well.

Cheers,
   Tony

-=-=-=-=-

[Here's the outline I was following as I recorded this talk.]

Hi everyone.

I'm Tony Garnock-Jones, it's March 30th 2021, and I'm going to walk
through the experimentation I've been doing on nested Namespaces in
Squeak Smalltalk.

This work builds on Squeak's Environments, which I think are originally
due to Colin Putney with some recent work by Jakob Reschke.

I've made some small additions to Environment, and a little subclass
called Namespace, which allows one to expose Environments via ordinary
variable reference, if one so chooses. It doesn't change anything about
how Environments work otherwise, so existing uses should remain unchanged.

I've also added a variant of Browser that shows these accessible
Environments in a hierarchy, and allows you to manage their imports and
exports. Here it is.

[Open an EnvironmentBrowser]
[Navigate to EnvironmentBrowser]

The tool is called EnvironmentBrowser, and it's a very thin veneer over
the existing underlying Environment machinery.

You can see that compared to the default browser, it has a couple of
extra panels.

This one [on the left] is a tree of environments. The idea is to take
Environment's Instances as "well-known" roots for this tree:

   Environment wellKnownInstances

Smalltalk is already in there, and at the moment there are no others.

 From the roots, we recursively scan each environment for globals that
are also Environments. This scan is a part of Environment itself:

[Navigate to Environment's namespaceTreeDo: method]

This other panel [on the left, just below the tree of environments]
shows the imports and exports of this environment.

Here you can see that the default environment, Smalltalk, imports all
its own bindings, so they're visible to its own classes, and exports all
its bindings to other Environments that import from Smalltalk.

[Create namespace NS1]
[Create class String, extends Object, inst var length, category Demo]
[Create accessors]

printOn: aStream
        aStream nextPutAll: 'I am a ball of wool ', length, ' metres long'

[class side]
new: size
        ^ self new length: size
[Proceed on the warning]

[Open workspace in Smalltalk]
String new: 3

[Open workspace in NS1]
String new: 3

[Rename NS1 to Fabric]
[Create namespace NS2]
[Import Fabric with prefix Fabric]

[Open workspace in NS2]
String new: 3
FabricString new: 3
"Oh! It didn't work! We didn't export it from Fabric."

[Export all from Fabric]
[Try again - still doesn't work]
[Redo the import]
[Try again - works now!]

There are still some issues with, I think, Environments themselves
propagating changes to each other.

Fabric String new: 3

[Unlink Fabric]

Now we see:

String new: 3
FabricString new: 3
Fabric String new: 3  "error on this, Fabric is missing"

[Remove the policy importing Fabric to NS2]

Didn't remove it. Still some bugs.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210407/9d8ca1b8/attachment-0001.html>


More information about the Squeak-dev mailing list