[squeak-dev] Re: [Pharo-project] Multiple issues with class definition

Marcus Denker denker at acm.org
Fri Apr 10 12:11:45 UTC 2009


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).

> 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.

	Marcus

--
Marcus Denker  --  denker at acm.org
http://www.marcusdenker.de




More information about the Squeak-dev mailing list