[squeak-dev] Environments question
ma.chris.m at gmail.com
Tue Apr 8 01:10:18 UTC 2014
> On Mon, Apr 7, 2014 at 1:40 PM, Chris Muller <asqueaker at gmail.com> wrote:
>> As I was programming in Squeak today, I typed a class name, including
>> its two-letter prefix. I wondered, could Environments be used to,
>> dynamically, only in transient memory, remove a prefix from a package?
>> It would be nice to enjoy typing and reading the pure, unprefixed
>> class names, but would want to keep the original prefixes when I save
>> a new version of the package.
> I'm not sure what you mean by "dynamically, only in transient memory" here.
> You could certainly load a package that has prefixed-class-names and refer
> to those classes without prefixes. It would be something like this:
> | magmaEnv appEnv |
> magmaEnv := Environment withName: 'Magma'.
> magmaEnv exportSelf.
> appEnv := Environment withName: 'My App'.
> import: magmaEnv removingPrefix: 'Ma';
> Load your prefixed Magma classes into magmaEnv, and then write your app code
> in appEnv referring to Magma classes without prefixes.
That example gave me a lot of context, thanks. So, that would allow
me to see and type "ObjectSerializer" instead of MaObjectSerializer.
Great! The system is more beautiful.
Now say I save a new MC version of "My App" package. I've made a
couple of new references to ObjectSerializer. Now I load that version
into a clean image without creating any environments at all. Will I
see ObjectSerializer or MaObjectSerializer in the code?
My knowledge of Environments is still very limited, maybe
transient-renames could be a good excuse to find time to unbox and try
More information about the Squeak-dev