[squeak-dev] Nested Environments demo

Jakob Reschke jakres+squeak at gmail.com
Wed Apr 7 16:30:21 UTC 2021


Hi Tony,

This looks great and like the tool support that Environments have been
missing for some time. I had expected that the Namespace concept would
spawn more controversial discussion. Anyway, just the availability of the
tool would be a welcome addition in my opinion.

As for those bugs, I guess the community needs to have some discussion and
agreement about what the expected behavior would be, though Environments
does not seem to be the most favorite topic around. From the
comprehensibility perspective, I agree with you that it should behave in
less surprising ways than it currently does.

Also thank you for the mention, although I'm humbly not sure whether I
deserve the naming next to Colin on that matter. ;-)

Kind regards,
Jakob

Am Di., 30. März 2021 um 14:12 Uhr schrieb Tony Garnock-Jones <
tonyg at leastfixedpoint.com>:

> 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/90728522/attachment.html>


More information about the Squeak-dev mailing list