[squeak-dev] Environments question
colin at wiresong.com
Tue Apr 8 03:51:28 UTC 2014
On Mon, Apr 7, 2014 at 8:51 PM, Chris Muller <ma.chris.m at gmail.com> wrote:
> Hm, okay. So when I ran that example code earlier to create the 'My
> App' Environment,
> | magmaEnv appEnv |
> magmaEnv := Environment withName: 'Magma'.
> magmaEnv exportSelf.
> appEnv := Environment withName: 'My App'.
> import: magmaEnv removingPrefix: 'Ma';
> and then loaded Magma into its environment and My App into the My App
> environment, if I were to immediately then press the Changes button in
> the MC browser for My App, one might assume they should find lots of
> changes due to the stripping of the prefixes from the existing
> references to MaObjectSerializer now being without the prefix.
> Something tells me that's not what would happen though -- because that
> would require Environments to go making source-code updates and I'm
> doubtful it does that. Environments is just about multiple
> SystemDictionray's with different keys to support prettier /
> non-conflicting names. That's my high-level understanding of what
> Environments does, but I don't grok yet how it's supposed to be
> properly used..
That's exactly right. Environments swizzles bindings around so that you
to classes by whatever names you want, but it doesn't change your source
actually use those names.
If you've got a pre-existing MyApp that refers to Magma classes via
when you load it into appEnv, it won't have any changes, but all those
will be broken. You'll need to rewrite the source code to use the new
be fairly easy with the RB).
If you're starting your app from scratch, it's less of an issue. :-)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev