2017-03-05 2:00 GMT+01:00 David T. Lewis <[hidden email]>:
+1 Cautiousness of Chris is legitimate, but I see nothing irreversible in these changes. If not using Environment, there will be just an indirection to Smalltalk globals here and there. If using Environment, these are mandatory. |
In reply to this post by David T. Lewis
Make it so :)
On 05.03.2017, at 02:00, David T. Lewis <[hidden email]> wrote: > On Wed, Mar 01, 2017 at 04:40:56PM +0100, Tobias Pape wrote: >> Hi all, >> >> Should nobody object, I'll put Jakob's Environment improvements >> into the trunk tonight. >> >> Best regards >> -Tobias >> > > Can we please move these changes moved into trunk now? I see no reason for > delay and I do not want to wait for bit rot to set in. This is good work, > so let's just get it done. > > Thanks, > Dave > > |
On Sun, Mar 05, 2017 at 12:44:03PM +0100, Tobias Pape wrote:
> Make it so :) > OK. The Compiler, Monticello, and Environments packages will need merges, so expect some disruption over next hour or so. Dave > On 05.03.2017, at 02:00, David T. Lewis <[hidden email]> wrote: > > > On Wed, Mar 01, 2017 at 04:40:56PM +0100, Tobias Pape wrote: > >> Hi all, > >> > >> Should nobody object, I'll put Jakob's Environment improvements > >> into the trunk tonight. > >> > >> Best regards > >> -Tobias > >> > > > > Can we please move these changes moved into trunk now? I see no reason for > > delay and I do not want to wait for bit rot to set in. This is good work, > > so let's just get it done. > > > > Thanks, > > Dave > > > > > > |
On Sun, Mar 05, 2017 at 10:49:37AM -0500, David T. Lewis wrote:
> On Sun, Mar 05, 2017 at 12:44:03PM +0100, Tobias Pape wrote: > > Make it so :) > > > > OK. > > The Compiler, Monticello, and Environments packages will need merges, > so expect some disruption over next hour or so. > Packages are moved to trunk, and merges (hopefully) applied. The update stream is broken, so I think that a new update map is needed. Looking at it now. Dave > > > > On 05.03.2017, at 02:00, David T. Lewis <[hidden email]> wrote: > > > > > On Wed, Mar 01, 2017 at 04:40:56PM +0100, Tobias Pape wrote: > > >> Hi all, > > >> > > >> Should nobody object, I'll put Jakob's Environment improvements > > >> into the trunk tonight. > > >> > > >> Best regards > > >> -Tobias > > >> > > > > > > Can we please move these changes moved into trunk now? I see no reason for > > > delay and I do not want to wait for bit rot to set in. This is good work, > > > so let's just get it done. > > > > > > Thanks, > > > Dave > > > > > > > > > > > |
On Sun, Mar 05, 2017 at 11:44:31AM -0500, David T. Lewis wrote:
> On Sun, Mar 05, 2017 at 10:49:37AM -0500, David T. Lewis wrote: > > On Sun, Mar 05, 2017 at 12:44:03PM +0100, Tobias Pape wrote: > > > Make it so :) > > > > > > > OK. > > > > The Compiler, Monticello, and Environments packages will need merges, > > so expect some disruption over next hour or so. > > > > Packages are moved to trunk, and merges (hopefully) applied. > > The update stream is broken, so I think that a new update map is needed. > Looking at it now. > The new update map is done, and all seems well again now. Dave |
In reply to this post by Bert Freudenberg
Hi Both, Can this conversation be captured as something like a workspace text which can be opened from the Help menu in the menu bar? I'd love to see something like "Working With Environments" underneath "Working With Squeak". On Thu, Mar 2, 2017 at 3:06 PM, Bert Freudenberg <[hidden email]> wrote:
_,,,^..^,,,_ best, Eliot |
Or even better, some entries in the 'Help System'
It should include the 'Hello World' example from October 2016. http://wiki.squeak.org/squeak/6557 I volunteer to help. --Hannes On 3/6/17, Eliot Miranda <[hidden email]> wrote: > Hi Both, > > Can this conversation be captured as something like a workspace text which > can be opened from the Help menu in the menu bar? I'd love to see > something like "Working With Environments" underneath "Working With > Squeak". > > On Thu, Mar 2, 2017 at 3:06 PM, Bert Freudenberg <[hidden email]> > wrote: > >> Let me see if I understand ... >> >> On Thu, Mar 2, 2017 at 3:45 AM, Jakob Reschke < >> [hidden email]> wrote: >> >>> >>> 1. prepare the environment in a workspace, because there are no tools >>> for >>> it: >>> >>> env := Environment named: #NewProjectWithPharoBindings. >>> >> >> This creates a new empty environment. >> >> >>> env import: Smalltalk globals. >>> >> >> This makes all current classes available inside the new environment. >> >> >>> env from: Smalltalk globals import: { #FSFilesystem -> #FileSystem. >>> #FSPath -> #Path. "..." } >>> >> >> This makes the FS classes (which you loaded previously) available under >> the non-prefixed name, too. >> >> >>> env importSelf; >> >> >> Makes future declarations in this environment visible to itself. >> >> >>> exportSelf. >> >> >> Makes future changes in this environment visible to other environments >> that imported it. >> >> >>> 2. open a Workspace that "lives" in the new environment: >>> >>> env beCurrentDuring: [Workspace open] >>> >>> ...and change its title to remember its purpose. >>> >> >> Yoshiki and I tried that but evaluating code still appears to use the >> Smalltalk environment. We had to change the evaluateSelectionAndDo: >> method >> in the Morphic package to use the model's environment. Is that a change >> you >> missed? >> >> In general it appears to be working well, although the tool support is >> minimal for now. It would be useful if environment-aware tools indicated >> the current environment (if it is not the default). >> >> The general metaphor seems to be that an environment just replaces the >> global Smalltalk dictionary with its own, but the code in general doesn't >> even have to be aware of the existence of other environments. This is in >> contrast to how other systems handle modules and namespaces. Would you >> think this is a fair characterization? >> >> - Bert - >> >> >> >> > > > -- > _,,,^..^,,,_ > best, Eliot > |
Hello Jakob
A follow up on the previous mail to find out more which Environment support now can be made use of. I understand that the I can choose an environment in the left pane of a Monticello Browser (see screen shot). 1. I have created the environment with henv := Environment withName: 'HJHenvironment'. henv import: Smalltalk globals. henv importSelf. henv exportSelf. 2. Then I choose the environment 'HJHenvironment' in the Monticello Browser 3. Then I load an MCZ package and open a SystemBrowser. Question: Are these classes loaded into the new environment? Actually it see the classes if I open a SystemBrowser. However I still see them after I have changed back the environment to 'Smalltalk' in a newly opened browser. You write that the tool support for environments is minimal. How do I use this 'minimal support' successfully? Regards Hannes How do I now file in an mcz file into the new and open a SystemBrowser on it showing the imported classes? On 3/7/17, H. Hirzel <[hidden email]> wrote: > Or even better, some entries in the 'Help System' > > It should include the 'Hello World' example from October 2016. > > http://wiki.squeak.org/squeak/6557 > > I volunteer to help. > > --Hannes > > On 3/6/17, Eliot Miranda <[hidden email]> wrote: >> Hi Both, >> >> Can this conversation be captured as something like a workspace text >> which >> can be opened from the Help menu in the menu bar? I'd love to see >> something like "Working With Environments" underneath "Working With >> Squeak". >> >> On Thu, Mar 2, 2017 at 3:06 PM, Bert Freudenberg <[hidden email]> >> wrote: >> >>> Let me see if I understand ... >>> >>> On Thu, Mar 2, 2017 at 3:45 AM, Jakob Reschke < >>> [hidden email]> wrote: >>> >>>> >>>> 1. prepare the environment in a workspace, because there are no tools >>>> for >>>> it: >>>> >>>> env := Environment named: #NewProjectWithPharoBindings. >>>> >>> >>> This creates a new empty environment. >>> >>> >>>> env import: Smalltalk globals. >>>> >>> >>> This makes all current classes available inside the new environment. >>> >>> >>>> env from: Smalltalk globals import: { #FSFilesystem -> #FileSystem. >>>> #FSPath -> #Path. "..." } >>>> >>> >>> This makes the FS classes (which you loaded previously) available under >>> the non-prefixed name, too. >>> >>> >>>> env importSelf; >>> >>> >>> Makes future declarations in this environment visible to itself. >>> >>> >>>> exportSelf. >>> >>> >>> Makes future changes in this environment visible to other environments >>> that imported it. >>> >>> >>>> 2. open a Workspace that "lives" in the new environment: >>>> >>>> env beCurrentDuring: [Workspace open] >>>> >>>> ...and change its title to remember its purpose. >>>> >>> >>> Yoshiki and I tried that but evaluating code still appears to use the >>> Smalltalk environment. We had to change the evaluateSelectionAndDo: >>> method >>> in the Morphic package to use the model's environment. Is that a change >>> you >>> missed? >>> >>> In general it appears to be working well, although the tool support is >>> minimal for now. It would be useful if environment-aware tools indicated >>> the current environment (if it is not the default). >>> >>> The general metaphor seems to be that an environment just replaces the >>> global Smalltalk dictionary with its own, but the code in general >>> doesn't >>> even have to be aware of the existence of other environments. This is in >>> contrast to how other systems handle modules and namespaces. Would you >>> think this is a fair characterization? >>> >>> - Bert - >>> >>> >>> >>> >> >> >> -- >> _,,,^..^,,,_ >> best, Eliot >> > |
On 3/22/17, H. Hirzel <[hidden email]> wrote:
> Hello Jakob > > A follow up on the previous mail to find out more which Environment > support now can be made use of. > > > I understand that the I can choose an environment in the left pane of > a Monticello Browser (see screen shot). > > 1. I have created the environment with > > henv := Environment withName: 'HJHenvironment'. > henv import: Smalltalk globals. > henv importSelf. > henv exportSelf. > > 2. Then I choose the environment 'HJHenvironment' in the Monticello Browser > > 3. Then I load an MCZ package and open a SystemBrowser. > > Question: > Are these classes loaded into the new environment? > > Actually it see the classes if I open a SystemBrowser. > > However I still see them after I have changed back the environment to > 'Smalltalk' in a newly opened browser. > > You write that the tool support for environments is minimal. > > How do I use this 'minimal support' successfully? > > Regards > > Hannes > > > How do I now file in an mcz file into the new and open a SystemBrowser > on it showing the imported classes? > > > On 3/7/17, H. Hirzel <[hidden email]> wrote: >> Or even better, some entries in the 'Help System' >> >> It should include the 'Hello World' example from October 2016. >> >> http://wiki.squeak.org/squeak/6557 >> >> I volunteer to help. >> >> --Hannes >> >> On 3/6/17, Eliot Miranda <[hidden email]> wrote: >>> Hi Both, >>> >>> Can this conversation be captured as something like a workspace text >>> which >>> can be opened from the Help menu in the menu bar? I'd love to see >>> something like "Working With Environments" underneath "Working With >>> Squeak". >>> >>> On Thu, Mar 2, 2017 at 3:06 PM, Bert Freudenberg <[hidden email]> >>> wrote: >>> >>>> Let me see if I understand ... >>>> >>>> On Thu, Mar 2, 2017 at 3:45 AM, Jakob Reschke < >>>> [hidden email]> wrote: >>>> >>>>> >>>>> 1. prepare the environment in a workspace, because there are no tools >>>>> for >>>>> it: >>>>> >>>>> env := Environment named: #NewProjectWithPharoBindings. >>>>> >>>> >>>> This creates a new empty environment. >>>> >>>> >>>>> env import: Smalltalk globals. >>>>> >>>> >>>> This makes all current classes available inside the new environment. >>>> >>>> >>>>> env from: Smalltalk globals import: { #FSFilesystem -> #FileSystem. >>>>> #FSPath -> #Path. "..." } >>>>> >>>> >>>> This makes the FS classes (which you loaded previously) available under >>>> the non-prefixed name, too. >>>> >>>> >>>>> env importSelf; >>>> >>>> >>>> Makes future declarations in this environment visible to itself. >>>> >>>> >>>>> exportSelf. >>>> >>>> >>>> Makes future changes in this environment visible to other environments >>>> that imported it. >>>> >>>> >>>>> 2. open a Workspace that "lives" in the new environment: >>>>> >>>>> env beCurrentDuring: [Workspace open] >>>>> >>>>> ...and change its title to remember its purpose. >>>>> >>>> >>>> Yoshiki and I tried that but evaluating code still appears to use the >>>> Smalltalk environment. We had to change the evaluateSelectionAndDo: >>>> method >>>> in the Morphic package to use the model's environment. Is that a change >>>> you >>>> missed? >>>> >>>> In general it appears to be working well, although the tool support is >>>> minimal for now. It would be useful if environment-aware tools >>>> indicated >>>> the current environment (if it is not the default). >>>> >>>> The general metaphor seems to be that an environment just replaces the >>>> global Smalltalk dictionary with its own, but the code in general >>>> doesn't >>>> even have to be aware of the existence of other environments. This is >>>> in >>>> contrast to how other systems handle modules and namespaces. Would you >>>> think this is a fair characterization? >>>> >>>> - Bert - >>>> >>>> >>>> >>>> >>> >>> >>> -- >>> _,,,^..^,,,_ >>> best, Eliot >>> >> > Choose_Environment_in_Monticello_Browser_Screenshot_2017-03-22.png (35K) Download Attachment |
In reply to this post by Hannes Hirzel
Hello Hannes,
If the MCVersion you have loaded belongs into the package for which you have changed the environment, the classes should be loaded in that environment, not the default one. For example, in a fresh image I create a new environment 'NewEnvironment', add the yet unloaded package FS-Core in the Monticello Browser, change the package's (actually, the working copy's) environment like you did, then load a version of this package from a repository. Unless you import the new environment back into Smalltalk globals, you will only get a browser by "manual lookup" in the environment like this: `(newEnvironment at: #FileSystem) browse`. Because there is environment activating code in MCVersion>>load, it should also work when you drag mcz files into the image. ...yep, it does. So if it did not work for you, please check if the package names of your working copy and the version in the mcz file are equal. In my example, it would not have worked if I had added a package 'FS' (instead of 'FS-Core'), because the MCVersion's package is 'FS-Core', not 'FS'. Kind regards, Jakob 2017-03-22 12:52 GMT+01:00 H. Hirzel <[hidden email]>: > Hello Jakob > > A follow up on the previous mail to find out more which Environment > support now can be made use of. > > > I understand that the I can choose an environment in the left pane of > a Monticello Browser (see screen shot). > > 1. I have created the environment with > > henv := Environment withName: 'HJHenvironment'. > henv import: Smalltalk globals. > henv importSelf. > henv exportSelf. > > 2. Then I choose the environment 'HJHenvironment' in the Monticello Browser > > 3. Then I load an MCZ package and open a SystemBrowser. > > Question: > Are these classes loaded into the new environment? > > Actually it see the classes if I open a SystemBrowser. > > However I still see them after I have changed back the environment to > 'Smalltalk' in a newly opened browser. > > You write that the tool support for environments is minimal. > > How do I use this 'minimal support' successfully? > > Regards > > Hannes > > > How do I now file in an mcz file into the new and open a SystemBrowser > on it showing the imported classes? > > > On 3/7/17, H. Hirzel <[hidden email]> wrote: >> Or even better, some entries in the 'Help System' >> >> It should include the 'Hello World' example from October 2016. >> >> http://wiki.squeak.org/squeak/ >> >> I volunteer to help. >> >> --Hannes >> >> On 3/6/17, Eliot Miranda <[hidden email]> wrote: >>> Hi Both, >>> >>> Can this conversation be captured as something like a workspace text >>> which >>> can be opened from the Help menu in the menu bar? I'd love to see >>> something like "Working With Environments" underneath "Working With >>> Squeak". >>> >>> On Thu, Mar 2, 2017 at 3:06 PM, Bert Freudenberg <[hidden email]> >>> wrote: >>> >>>> Let me see if I understand ... >>>> >>>> On Thu, Mar 2, 2017 at 3:45 AM, Jakob Reschke < >>>> [hidden email]> wrote: >>>> >>>>> >>>>> 1. prepare the environment in a workspace, because there are no tools >>>>> for >>>>> it: >>>>> >>>>> env := Environment named: #NewProjectWithPharoBindings. >>>>> >>>> >>>> This creates a new empty environment. >>>> >>>> >>>>> env import: Smalltalk globals. >>>>> >>>> >>>> This makes all current classes available inside the new environment. >>>> >>>> >>>>> env from: Smalltalk globals import: { #FSFilesystem -> #FileSystem. >>>>> #FSPath -> #Path. "..." } >>>>> >>>> >>>> This makes the FS classes (which you loaded previously) available under >>>> the non-prefixed name, too. >>>> >>>> >>>>> env importSelf; >>>> >>>> >>>> Makes future declarations in this environment visible to itself. >>>> >>>> >>>>> exportSelf. >>>> >>>> >>>> Makes future changes in this environment visible to other environments >>>> that imported it. >>>> >>>> >>>>> 2. open a Workspace that "lives" in the new environment: >>>>> >>>>> env beCurrentDuring: [Workspace open] >>>>> >>>>> ...and change its title to remember its purpose. >>>>> >>>> >>>> Yoshiki and I tried that but evaluating code still appears to use the >>>> Smalltalk environment. We had to change the evaluateSelectionAndDo: >>>> method >>>> in the Morphic package to use the model's environment. Is that a change >>>> you >>>> missed? >>>> >>>> In general it appears to be working well, although the tool support is >>>> minimal for now. It would be useful if environment-aware tools indicated >>>> the current environment (if it is not the default). >>>> >>>> The general metaphor seems to be that an environment just replaces the >>>> global Smalltalk dictionary with its own, but the code in general >>>> doesn't >>>> even have to be aware of the existence of other environments. This is in >>>> contrast to how other systems handle modules and namespaces. Would you >>>> think this is a fair characterization? >>>> >>>> - Bert - >>>> >>>> >>>> >>>> >>> >>> >>> -- >>> _,,,^..^,,,_ >>> best, Eliot >>> >> |
In case somebody wonders what the difference between `Environment withName:` and `Environment named:` is: there is a class pool variable named 'Instances' in Environment. #named: registers the new instance there, #withName: does not. It shouldn't make a difference for loading a version like above, though. 2017-03-22 13:29 GMT+01:00 Jakob Reschke <[hidden email]>:
|
Hi Jakob,
is this difference useful? What purposes do unregistered environments satisfy? Isn't it just a way of loosing my code without realizing it?
|
2017-03-22 14:50 GMT+01:00 Eliot Miranda <[hidden email]>:
I don't think you can loose code. Double-link superclass/subclasses will prevent most damages, classes point to their environment too. If I remember, there is no API yet for de-registering an environment, so withName: is mandatory for writing unit tests at the moment. But I have no code under my eyes, so to be confirmed. My feeling is that the register should point weakly and that we should keep only one API...
|
In reply to this post by Eliot Miranda-2
On 3/22/17, Eliot Miranda <[hidden email]> wrote:
> Hi Jakob, > >> On Mar 22, 2017, at 5:36 AM, Jakob Reschke <[hidden email]> >> wrote: >> >> In case somebody wonders what the difference between `Environment >> withName:` and `Environment named:` is: there is a class pool variable >> named 'Instances' in Environment. #named: registers the new instance >> there, #withName: does not. Thanks, Jakob, for the note about this important distinction. And for the screen shot which shows how the Pharo FileSystem may be loaded. >> It shouldn't make a difference for loading a >> version like above, though. > > is this difference useful? What purposes do unregistered environments > satisfy? Isn't it just a way of loosing my code without realizing it? Environment withName: 'theNameOfMyEnvironment' is used in EnvironmentTest. Maybe we should have method comments which emphasize this distinction. And what is the proper way of 'unregistering' an environment? For the test cases it is just tearDown env destroy. env := nil For the case done with Environment named: 'myEnvironment' I just see Environment >> destroy self allClasses do: [:ea | ea removeFromSystem]. declarations keys do: [:ea | self unbind: ea]. policies do: [:ea | ea removeObserver: self]. observers do: [:ea | ea stopObserving: self]. Is this all I have to do or do I need to do something more to unregister an environment? --Hannes >> >> 2017-03-22 13:29 GMT+01:00 Jakob Reschke <[hidden email]>: >>> Hello Hannes, >>> >>> If the MCVersion you have loaded belongs into the package for which you >>> have changed the environment, the classes should be loaded in that >>> environment, not the default one. >>> >>> For example, in a fresh image I create a new environment >>> 'NewEnvironment', add the yet unloaded package FS-Core in the Monticello >>> Browser, change the package's (actually, the working copy's) environment >>> like you did, then load a version of this package from a repository. >>> Unless you import the new environment back into Smalltalk globals, you >>> will only get a browser by "manual lookup" in the environment like this: >>> `(newEnvironment at: #FileSystem) browse`. >>> >>> <Capture.PNG> >>> >>> Because there is environment activating code in MCVersion>>load, it >>> should also work when you drag mcz files into the image. ...yep, it >>> does. >>> >>> So if it did not work for you, please check if the package names of your >>> working copy and the version in the mcz file are equal. In my example, it >>> would not have worked if I had added a package 'FS' (instead of >>> 'FS-Core'), because the MCVersion's package is 'FS-Core', not 'FS'. >>> >>> Kind regards, >>> Jakob >>> >>> >>> >>> 2017-03-22 12:52 GMT+01:00 H. Hirzel <[hidden email]>: >>> > Hello Jakob >>> > >>> > A follow up on the previous mail to find out more which Environment >>> > support now can be made use of. >>> > >>> > >>> > I understand that the I can choose an environment in the left pane of >>> > a Monticello Browser (see screen shot). >>> > >>> > 1. I have created the environment with >>> > >>> > henv := Environment withName: 'HJHenvironment'. >>> > henv import: Smalltalk globals. >>> > henv importSelf. >>> > henv exportSelf. >>> > >>> > 2. Then I choose the environment 'HJHenvironment' in the Monticello >>> > Browser >>> > >>> > 3. Then I load an MCZ package and open a SystemBrowser. >>> > >>> > Question: >>> > Are these classes loaded into the new environment? >>> > >>> > Actually it see the classes if I open a SystemBrowser. >>> > >>> > However I still see them after I have changed back the environment to >>> > 'Smalltalk' in a newly opened browser. >>> > >>> > You write that the tool support for environments is minimal. >>> > >>> > How do I use this 'minimal support' successfully? >>> > >>> > Regards >>> > >>> > Hannes >>> > >>> > >>> > How do I now file in an mcz file into the new and open a SystemBrowser >>> > on it showing the imported classes? >>> > >>> > >>> > On 3/7/17, H. Hirzel <[hidden email]> wrote: >>> >> Or even better, some entries in the 'Help System' >>> >> >>> >> It should include the 'Hello World' example from October 2016. >>> >> >>> >> http://wiki.squeak.org/squeak/6557 >>> >> >>> >> I volunteer to help. >>> >> >>> >> --Hannes >>> >> >>> >> On 3/6/17, Eliot Miranda <[hidden email]> wrote: >>> >>> Hi Both, >>> >>> >>> >>> Can this conversation be captured as something like a workspace text >>> >>> which >>> >>> can be opened from the Help menu in the menu bar? I'd love to see >>> >>> something like "Working With Environments" underneath "Working With >>> >>> Squeak". >>> >>> >>> >>> On Thu, Mar 2, 2017 at 3:06 PM, Bert Freudenberg >>> >>> <[hidden email]> >>> >>> wrote: >>> >>> >>> >>>> Let me see if I understand ... >>> >>>> >>> >>>> On Thu, Mar 2, 2017 at 3:45 AM, Jakob Reschke < >>> >>>> [hidden email]> wrote: >>> >>>> >>> >>>>> >>> >>>>> 1. prepare the environment in a workspace, because there are no >>> >>>>> tools >>> >>>>> for >>> >>>>> it: >>> >>>>> >>> >>>>> env := Environment named: #NewProjectWithPharoBindings. >>> >>>>> >>> >>>> >>> >>>> This creates a new empty environment. >>> >>>> >>> >>>> >>> >>>>> env import: Smalltalk globals. >>> >>>>> >>> >>>> >>> >>>> This makes all current classes available inside the new >>> >>>> environment. >>> >>>> >>> >>>> >>> >>>>> env from: Smalltalk globals import: { #FSFilesystem -> >>> >>>>> #FileSystem. >>> >>>>> #FSPath -> #Path. "..." } >>> >>>>> >>> >>>> >>> >>>> This makes the FS classes (which you loaded previously) available >>> >>>> under >>> >>>> the non-prefixed name, too. >>> >>>> >>> >>>> >>> >>>>> env importSelf; >>> >>>> >>> >>>> >>> >>>> Makes future declarations in this environment visible to itself. >>> >>>> >>> >>>> >>> >>>>> exportSelf. >>> >>>> >>> >>>> >>> >>>> Makes future changes in this environment visible to other >>> >>>> environments >>> >>>> that imported it. >>> >>>> >>> >>>> >>> >>>>> 2. open a Workspace that "lives" in the new environment: >>> >>>>> >>> >>>>> env beCurrentDuring: [Workspace open] >>> >>>>> >>> >>>>> ...and change its title to remember its purpose. >>> >>>>> >>> >>>> >>> >>>> Yoshiki and I tried that but evaluating code still appears to use >>> >>>> the >>> >>>> Smalltalk environment. We had to change the evaluateSelectionAndDo: >>> >>>> method >>> >>>> in the Morphic package to use the model's environment. Is that a >>> >>>> change >>> >>>> you >>> >>>> missed? >>> >>>> >>> >>>> In general it appears to be working well, although the tool support >>> >>>> is >>> >>>> minimal for now. It would be useful if environment-aware tools >>> >>>> indicated >>> >>>> the current environment (if it is not the default). >>> >>>> >>> >>>> The general metaphor seems to be that an environment just replaces >>> >>>> the >>> >>>> global Smalltalk dictionary with its own, but the code in general >>> >>>> doesn't >>> >>>> even have to be aware of the existence of other environments. This >>> >>>> is in >>> >>>> contrast to how other systems handle modules and namespaces. Would >>> >>>> you >>> >>>> think this is a fair characterization? >>> >>>> >>> >>>> - Bert - >>> >>>> >>> >>>> >>> >>>> >>> >>>> >>> >>> >>> >>> >>> >>> -- >>> >>> _,,,^..^,,,_ >>> >>> best, Eliot >>> >>> >>> >> >>> >> >> > Environment_named_registers_instance_Screenshot_2017-03-22.png (166K) Download Attachment |
In reply to this post by Hannes Hirzel
On Wed, Mar 22, 2017 at 12:52 PM, H. Hirzel <[hidden email]> wrote: Hello Jakob That's not how it works (yet) ... You need to create an empty WorkingCopy for your package first by pressing the "+Package" button. Then you can use the menu to chose the environment for the package you selected. 3. Then I load an MCZ package and open a SystemBrowser. That means they were not loaded into the environment. If you did it as above, you should not see the classes in the SystemBrowser, only their empty category names (because categories are not "environmentized" yet). How do I use this 'minimal support' successfully? As indicated above, and manually in a workspace. E.g. you can inspect your "henv" after loading your package and see that the class declarations are in its 'declarations' dictionary. I don't think there is a way right now to actually see an environment's classes in a browser. The only use for the environments so far is that it lets you build an image with packages that have conflicting class names. This was not possible before at all, so it's a step forward. But we need more tool support, especially for browsing an environment, and for directly specifying an environment when loading a package (without having to manually create it first). - Bert - |
In reply to this post by Jakob Reschke-2
I forgot to mention that you can also retrieve an environment with
#named:. So #withName: will create new environments each time like a constructor, whereas #named: is rather a lazily initializing accessor. Each does have its uses, but as Hannes pointed out, this should go into the comments. Possibly also the class comment of Environment. 2017-03-22 14:50 GMT+01:00 Eliot Miranda <[hidden email]>: > Hi Jakob, > > On Mar 22, 2017, at 5:36 AM, Jakob Reschke <[hidden email]> > wrote: > > In case somebody wonders what the difference between `Environment withName:` > and `Environment named:` is: there is a class pool variable named > 'Instances' in Environment. #named: registers the new instance there, > #withName: does not. It shouldn't make a difference for loading a version > like above, though. > > > is this difference useful? What purposes do unregistered environments > satisfy? Isn't it just a way of loosing my code without realizing it? > > _,,,^..^,,,_ (phone) > > > 2017-03-22 13:29 GMT+01:00 Jakob Reschke <[hidden email]>: >> >> Hello Hannes, >> >> If the MCVersion you have loaded belongs into the package for which you >> have changed the environment, the classes should be loaded in that >> environment, not the default one. >> >> For example, in a fresh image I create a new environment 'NewEnvironment', >> add the yet unloaded package FS-Core in the Monticello Browser, change the >> package's (actually, the working copy's) environment like you did, then load >> a version of this package from a repository. Unless you import the new >> environment back into Smalltalk globals, you will only get a browser by >> "manual lookup" in the environment like this: `(newEnvironment at: >> #FileSystem) browse`. >> >> <Capture.PNG> >> >> Because there is environment activating code in MCVersion>>load, it should >> also work when you drag mcz files into the image. ...yep, it does. >> >> So if it did not work for you, please check if the package names of your >> working copy and the version in the mcz file are equal. In my example, it >> would not have worked if I had added a package 'FS' (instead of 'FS-Core'), >> because the MCVersion's package is 'FS-Core', not 'FS'. >> >> Kind regards, >> Jakob >> >> >> >> 2017-03-22 12:52 GMT+01:00 H. Hirzel <[hidden email]>: >> > Hello Jakob >> > >> > A follow up on the previous mail to find out more which Environment >> > support now can be made use of. >> > >> > >> > I understand that the I can choose an environment in the left pane of >> > a Monticello Browser (see screen shot). >> > >> > 1. I have created the environment with >> > >> > henv := Environment withName: 'HJHenvironment'. >> > henv import: Smalltalk globals. >> > henv importSelf. >> > henv exportSelf. >> > >> > 2. Then I choose the environment 'HJHenvironment' in the Monticello >> > Browser >> > >> > 3. Then I load an MCZ package and open a SystemBrowser. >> > >> > Question: >> > Are these classes loaded into the new environment? >> > >> > Actually it see the classes if I open a SystemBrowser. >> > >> > However I still see them after I have changed back the environment to >> > 'Smalltalk' in a newly opened browser. >> > >> > You write that the tool support for environments is minimal. >> > >> > How do I use this 'minimal support' successfully? >> > >> > Regards >> > >> > Hannes >> > >> > >> > How do I now file in an mcz file into the new and open a SystemBrowser >> > on it showing the imported classes? >> > >> > >> > On 3/7/17, H. Hirzel <[hidden email]> wrote: >> >> Or even better, some entries in the 'Help System' >> >> >> >> It should include the 'Hello World' example from October 2016. >> >> >> >> http://wiki.squeak.org/squeak/6557 >> >> >> >> I volunteer to help. >> >> >> >> --Hannes >> >> >> >> On 3/6/17, Eliot Miranda <[hidden email]> wrote: >> >>> Hi Both, >> >>> >> >>> Can this conversation be captured as something like a workspace text >> >>> which >> >>> can be opened from the Help menu in the menu bar? I'd love to see >> >>> something like "Working With Environments" underneath "Working With >> >>> Squeak". >> >>> >> >>> On Thu, Mar 2, 2017 at 3:06 PM, Bert Freudenberg >> >>> <[hidden email]> >> >>> wrote: >> >>> >> >>>> Let me see if I understand ... >> >>>> >> >>>> On Thu, Mar 2, 2017 at 3:45 AM, Jakob Reschke < >> >>>> [hidden email]> wrote: >> >>>> >> >>>>> >> >>>>> 1. prepare the environment in a workspace, because there are no >> >>>>> tools >> >>>>> for >> >>>>> it: >> >>>>> >> >>>>> env := Environment named: #NewProjectWithPharoBindings. >> >>>>> >> >>>> >> >>>> This creates a new empty environment. >> >>>> >> >>>> >> >>>>> env import: Smalltalk globals. >> >>>>> >> >>>> >> >>>> This makes all current classes available inside the new environment. >> >>>> >> >>>> >> >>>>> env from: Smalltalk globals import: { #FSFilesystem -> >> >>>>> #FileSystem. >> >>>>> #FSPath -> #Path. "..." } >> >>>>> >> >>>> >> >>>> This makes the FS classes (which you loaded previously) available >> >>>> under >> >>>> the non-prefixed name, too. >> >>>> >> >>>> >> >>>>> env importSelf; >> >>>> >> >>>> >> >>>> Makes future declarations in this environment visible to itself. >> >>>> >> >>>> >> >>>>> exportSelf. >> >>>> >> >>>> >> >>>> Makes future changes in this environment visible to other >> >>>> environments >> >>>> that imported it. >> >>>> >> >>>> >> >>>>> 2. open a Workspace that "lives" in the new environment: >> >>>>> >> >>>>> env beCurrentDuring: [Workspace open] >> >>>>> >> >>>>> ...and change its title to remember its purpose. >> >>>>> >> >>>> >> >>>> Yoshiki and I tried that but evaluating code still appears to use the >> >>>> Smalltalk environment. We had to change the evaluateSelectionAndDo: >> >>>> method >> >>>> in the Morphic package to use the model's environment. Is that a >> >>>> change >> >>>> you >> >>>> missed? >> >>>> >> >>>> In general it appears to be working well, although the tool support >> >>>> is >> >>>> minimal for now. It would be useful if environment-aware tools >> >>>> indicated >> >>>> the current environment (if it is not the default). >> >>>> >> >>>> The general metaphor seems to be that an environment just replaces >> >>>> the >> >>>> global Smalltalk dictionary with its own, but the code in general >> >>>> doesn't >> >>>> even have to be aware of the existence of other environments. This is >> >>>> in >> >>>> contrast to how other systems handle modules and namespaces. Would >> >>>> you >> >>>> think this is a fair characterization? >> >>>> >> >>>> - Bert - >> >>>> >> >>>> >> >>>> >> >>>> >> >>> >> >>> >> >>> -- >> >>> _,,,^..^,,,_ >> >>> best, Eliot >> >>> >> >> >> > > |
In reply to this post by Eliot Miranda-2
2017-03-22 16:03 GMT+01:00 H. Hirzel <[hidden email]>:
> > And what is the proper way of 'unregistering' an environment? > Probably Environment>>destroy should also wipe the instance from Instances. Nicolas is right that there currently is no way to unregister an environment. There is not even a method to list the registered ones. > Environment >> > destroy > > self allClasses do: [:ea | ea removeFromSystem]. > declarations keys do: [:ea | self unbind: ea]. > policies do: [:ea | ea removeObserver: self]. > observers do: [:ea | ea stopObserving: self]. > > > Is this all I have to do or do I need to do something more to > unregister an environment? > > --Hannes > Currently, you would have to kick an environment out of Instances manually via inspectors or the like. After #destroy only, it is empty and disconnected from other environments, but it will not be garbage collected. So we could either make Instances weak-valued, or unregister on destroy. Or both... Note that an emptied and disconnected environment without behaviors (= currently useless?) will be garbage collected in the weak-Instances solution. |
In reply to this post by Hannes Hirzel
2017-03-22 16:21 GMT+01:00 Bert Freudenberg <[hidden email]>:
> On Wed, Mar 22, 2017 at 12:52 PM, H. Hirzel <[hidden email]> wrote: >> How do I use this 'minimal support' successfully? > > > As indicated above, and manually in a workspace. E.g. you can inspect your > "henv" after loading your package and see that the class declarations are in > its 'declarations' dictionary. > > I don't think there is a way right now to actually see an environment's > classes in a browser. As indicated, you can open browsers on behaviors in other environments with #browse, but you have to get hold of the behavior in the first place. You still need your workspace for that. There is currently no way to switch the environment of an already opened browser, except for manipulating its model object (e. g., with #selectEnvironment: in an inspector). One could add such an action to the category list's yellow button menu, next to "find class" and "back" (oh there is such thing, how nice). |
Free forum by Nabble | Edit this page |