Programming Question

John-Reed Maffeo rlpa80 at email.sps.mot.com
Fri Apr 9 15:02:37 UTC 1999


Kevin,

This is an answ3er from a newbie, but I do think it is correct.
You want to used the method "species" as shown below. I used this
technique in a fix to class Path that I posted recently.

Best Regards,

John-Reed Maffeo 
Mesa, Arizona

kpgrant at mindspring.com wrote:
> 
> Here's one I'm having trouble figuring out...
> 
> I have an object of class String something like the following:
> 
>   className := 'OrderedCollection'
> 
> What I want to do is something like:
> 
>   newObject := (className asClass) new

 newObject := className species new
> 
> Of course there is no such message as "asClass".  The problem
> is that I can find no way to cause newObject to become a new
> object of class OrderedCollection.  Basically, I've got a string
> object whose contents are the name of some class, and I need to be
> able to send class-side messages like "new" to whichever class
> is named in the string, but I can't seem to find a mechanism for
> doing this.
> 
> Thanks,
> -Kevin





More information about the Squeak-dev mailing list