Hi 2015-04-08 13:32 GMT+03:00 stepharo <stepharo@free.fr>:
Hi
We want to raise a strong warning against the extension of the use of asClass and friends. asClass should not be used in Pharo distribution. I will propose to deprecate it.
We are working on dependency analysis, module system, remote debugging and asClass introduces lose class references and many related problems.
I would like to remove this behavior because it is clear that it will just grow up and lead to deadcode and ugly dependencies.
First, most of the time you can avoid to query Smalltalk globals at: and that BY CONSTRUCTION a software system should be built and it should define its own customization.
Second, at least use self class environment at: #foo
Why is it much much much better? because it does not rely on String class resolution and as such is much more modular. You do not want to have the resolution of a symbol related to the place where String is defined but on where your code is actually.
To me it means that #asClass has wrong implementation and should be fixed like: String>>asClass thisContext sender class environment at: self Because users of code "'className' asClass" obviously want class from sender class environment.