Implementing a "prototype" in Pharo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Implementing a "prototype" in Pharo

Miso
Hi, I'm trying to creating a concept similar to "prototype" (like prototype-oriented programming) in Pharo. What I want is an object's methodDictionary to be stored in itself. So when I send a message to an instance, Pharo should look in the instance's dictionary (as opposed to class' dictionary) and call method stored there.

Closest thing I managed to do was create an anonymous class (subclass on my custom class) for each instance and return instance of this class, and store the anonymous class in the instance so I can work with it. Is there any other way to do it, without modifying compiler/VM or writing custom compiler? If not, please give some pointers where to look for some information about "core" of Pharo.

Thanks
Michael
Reply | Threaded
Open this post in threaded view
|

Re: Implementing a "prototype" in Pharo

Alexandre Bergel-4
Easy think is to create a doesNotUnderstand: method.
We experiment with prototypes in squeak some times ago.
http://www.iam.unibe.ch/~scg/Archive/Papers/Berg04cprototalk.pdf

Cheers,
Alexandre
On 24 Apr 2010, at 07:43, Miso wrote:

>
> Hi, I'm trying to creating a concept similar to "prototype" (like
> prototype-oriented programming) in Pharo. What I want is an object's
> methodDictionary to be stored in itself. So when I send a message to  
> an
> instance, Pharo should look in the instance's dictionary (as opposed  
> to
> class' dictionary) and call method stored there.
>
> Closest thing I managed to do was create an anonymous class  
> (subclass on my
> custom class) for each instance and return instance of this class,  
> and store
> the anonymous class in the instance so I can work with it. Is there  
> any
> other way to do it, without modifying compiler/VM or writing custom
> compiler? If not, please give some pointers where to look for some
> information about "core" of Pharo.
>
> Thanks
> Michael
> --
> View this message in context: http://forum.world.st/Implementing-a-prototype-in-Pharo-tp2063374p2063374.html
> Sent from the Pharo Smalltalk Users mailing list archive at  
> Nabble.com.
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: Implementing a "prototype" in Pharo

Stéphane Ducasse
In reply to this post by Miso
did you look at my JOOP paper available on my page?
It was done with VW but you could try on pharo

Now I know that adrian kuhn did a prototype implementation which was fun

http://scg.unibe.ch/staff/adriankuhn/protalk

On Apr 24, 2010, at 1:43 PM, Miso wrote:

>
> Hi, I'm trying to creating a concept similar to "prototype" (like
> prototype-oriented programming) in Pharo. What I want is an object's
> methodDictionary to be stored in itself. So when I send a message to an
> instance, Pharo should look in the instance's dictionary (as opposed to
> class' dictionary) and call method stored there.
>
> Closest thing I managed to do was create an anonymous class (subclass on my
> custom class) for each instance and return instance of this class, and store
> the anonymous class in the instance so I can work with it. Is there any
> other way to do it, without modifying compiler/VM or writing custom
> compiler? If not, please give some pointers where to look for some
> information about "core" of Pharo.
>
> Thanks
> Michael
> --
> View this message in context: http://forum.world.st/Implementing-a-prototype-in-Pharo-tp2063374p2063374.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users