Peter,
I have no answer for you as I am not a Pharo expert. It may be part of
an answer to your question "why?", however.
I think most if not all of the alternatives you mention are equally good
as long as you assume there is only one place to look for Classes.
As soon as you introduce namespaces to the equation, things get more
complicated. Depending on the logic of new implementations of these
lookup methods, the results may vary in such an environment.
just my 2 cents
Joachim
Am 10.02.18 um 12:57 schrieb Peter Uhnák:
Hi,
what is the canonical way to get a class from a symbol?
a) Converting symbol into class via string protocol
a.1) #Array asClass
I use this the most, because it is easy, uses unary selector, and so
far I've never ran into any issues. But apparently it is not good -- why?
a.2) #Array asClassInEnvironment: Smalltalk globals
b) Retriving the class by key from the system dictionary
b.1) Smalltalk globals at: #Array
b.2) Smalltalk at: #Array
b.3) Smalltalk classNamed: #Array
c) something else entirely?
I get that using #asClass wouldn't work if there was a different
environment, however I don't even know in what situation there could
be a different environment, so I cannot assert how problematic it is
or isn't.
Thanks,
Peter
--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel mailto:jtuc...@objektfabrik.de
Fliederweg 1 http://www.objektfabrik.de
D-71640 Ludwigsburg http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1