2009/4/10 Marcus Denker <[email protected]>: > > On 10.04.2009, at 05:34, Igor Stasenko wrote: > >> Another funny thing that i found, that you can actually do: >> >> | string | >> string := 'Blabla'. >> Object subclass: string >> instanceVariableNames: '' >> classVariableNames: '' >> poolDictionaries: '' >> category: 'Whatever'. >> >> Smalltalk at: string " returns a class you just defined." >> > > Yes, reflectively generating classes is what the browser does. And in > addition, > it is useful for tests. Or in general meta-programming tricks of the > evil kind. > (e.g. eToys used it to create on-the-fly classes for it's prototype- > like object > model. In most of these cases, it is better to use anonymous > Behaviors, than you don't > see them in the browser at all). >
Right, but for common case, this should be errorneous? No? At least Smalltalk>>#at:put: should check that key is symbol. >> Its fun, but having no sense. What is interesting that OB can display >> this class (but not in a regular way, you can find it in smart groups >> pane, after searching for 'Blabla'). > > > I think this is because the new class is not packaged. The old browser > shows > it in the class category 'Whatever', indistinguishable from a class > created with > the browser. I'm not sure what the difference from class created by browser.. A browser IMO should use very same message(s), sent to a class which should be a superclass for newly created new class(es). Doing otherwise would lead to multiple entry points into classes internals, which leads to exponential growth of complexity. > > Marcus > > -- > Marcus Denker -- [email protected] > http://www.marcusdenker.de > > > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > -- Best regards, Igor Stasenko AKA sig. _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
