On Sun, Nov 18, 2012 at 10:40 PM, James Foster <[email protected]>wrote:
> I don't see the benefit of the added complexity. As it is now, at compile > time the reference is not bound to a global but to an Association holding > the global. If you want to change the value of the global you can do so and > the method will reference the new value. Also, if you want to do > name-lookup at runtime you can explicitly code it to do that. > > My objection to always doing run-time name lookup is that I would like to > be able to create a module that is self-contained and binds to the the > classes I provide without risking that someone else will replace my > classes. I would like you to be able to load my module, containing my > classes and methods, and we both can be confident that your later changes > (including different classes with the same name) will not impact my classes > and methods. > > If you want a parameterized module, then the module should be explicitly > coded to take a parameter and use it explicitly. I think it is not as clear > to let the module think it is referencing a Point but in fact play a trick > on it to have it reference a different class. > > - James > > On Nov 16, 2012, at 6:17 PM, Stéphane Ducasse wrote: > > > While I love the idea of sharing the systemDictionary class binding in > the method to gain immediate update in case of > > change I was questioning myself if we could not gain from not having > (for example to get parametrized modules). > > > > The point is that we are not constantly changing classes especially when > not programming but running program. > > > > So let us do some experiments: > > > > CompiledMethod allInstances size > > 58891 > > > > (CompiledMethod allInstances select: [:each | each classBinding value > name = #Point]) size > > 100 > > > > [CompiledMethod allInstances select: [:each | each classBinding value > name = #Point]] timeToRun > > 23 > > > > this is the best case since classBinding is at a fixed size > > > > now looking for any reference to Point > > > > (CompiledMethod allInstances select: [:cm | > > cm literals anySatisfy: [:each | each class = Association > > and: [each > key = #Point ]]]) size > > 134 methods. > > > > [CompiledMethod allInstances select: [:cm | > > cm literals anySatisfy: [:each | each class = Association > > and: [each > key = #Point ]]]] timeToRun > > 91 ms > > > > so it looks to me that this sharing is not something that we should not > changed if needed. > > > > What do you think? > > > > Stef > > > +1 -- Cheers, Peter
