On Fri, Jun 29, 2012 at 7:47 AM, Bert Freudenberg bert@freudenbergs.de wrote:
I don't like this at all. It's equivalent to a fully qualified class reference, ala VisualWorks Magma.Session or Göran's Magma::Session. Avoiding those is the whole point of this design. Environments should be invisible to the code inside them.
How is this different from having to use "MagmaSession", if the class is actually named "Session", in the Magma environment?
The code *has* to differentiate if it needs to use the same global from two different environments.
Yes, the code has to differentiate. But we do it by having two names for the same class, rather than having to classes with the same name. To Seaside it's Session, to Application it's SeasideSession. As far as Application is concerned, it's a happy coincidence that Seaside and Magma don't have any name clashes.
Today we achieve that lack of clashes by coordinating with other developers. Chris agrees not to create any classes that start with 'WA' and the Seaside team agrees not to create any classes that start with 'Ma'. With environments, Chris doesn't have to coordinate with the Seaside team and the policy doesn't have to set in advance.
The developer of Application gets to set the policy for how his dependencies will be handled. He might decide that he doesn't need to refer to Magma sessions directly and let that class be shadowed, or that Magma sessions are really more like Engagements, or that MagmaSession is nicer or that MaSession is fine. Maybe he wants to use WA and Ma to remind himself where a class comes from, or maybe he would rather names be clean and simple.
But whatever he decides, he writes Application code as though the community had conspired to make his particular use case easy. Once Application is written, it depends on certain classes having particular names, but it doesn't have any idea how its environment is organized. Even if Seaside 4.0 is organized differently, we can make a different set of imports and aliases to provide Application with the environment that it needs.
Colin