[squeak-dev] How to use Environments?
Tobias Pape
Das.Linux at gmx.de
Fri Sep 23 09:59:11 UTC 2016
Hi Colin,
do you have an idea here?
Best regards
-Tobias
On 16.09.2016, at 14:50, Jakob Reschke <jakob.reschke at student.hpi.de> wrote:
> Hello,
>
> I am having a look at Environments, but have not yet figured out, how
> to operate them. I would like to create a new environment with an
> additional binding for an existing class under another name, and load
> a package in that new environment.
>
> The most of a documentation I have found is http://wiki.squeak.org/squeak/6220
> and I have tried the following so far:
>
> testenv := Environment named: #TestEnv1.
> testenv import: Smalltalk globals.
> testenv from: Smalltalk globals import: { #String -> #MyString }.
> testenv importSelf.
> testenv exportSelf.
>
> However, testenv valueOf: #MyString or testenv valueOf: #String both
> return nil instead of the String class. Does it mean that the
> from:import: did not work? It seems to only add a policy to my
> environment, but no declarations or bindings.
>
> For evaluating something in context of the environment, I have found
> the EnvironmentLoader, but it does not seem to recognize the
> additional binding either:
>
> (EnvironmentLoader for: testenv) evaluate: 'MyString'. => nil
> (EnvironmentLoader for: testenv) evaluate: 'String'. => nil
>
> (at least the import of the original globals seems to have worked).
>
> What steps am I missing?
>
> Also it is not very convenient to make up strings of code everytime I
> want to do something in the other environment, is there a better way?
> Can I get a system browser for my environment (where saving a method
> compiles it with the environment bindings in place)?
>
> Best regards,
> Jakob
>
More information about the Squeak-dev
mailing list
|