Hi, there !
I've been studying this paper in the weekend, and, although I've found many things interesting, I can't understand the example which is presented at the beginning of the paper.
It's said that "polygon traits" wold hold the draw() and copy() methods, while the "prototypical polygon" would hold the parent attribute, and the "vertices" attribute (BTW, how an attribute is marked in self as a "parent" one?).
My question is: How's that possible ? I mean, if the "draw" method is declared in the parent "traits", then it has no access to the vertices list, as they are declared in the "prototype". So it is impossible to write a complete "draw" method. I suppose the list of vertices is declared in the "traits" object, at least in a minimalist way, and then repeated in its full format in the prototype polygon. Or perhaps the "draw" method in the traits object is an empty one, and the method is repeated in the polygon prototype object.
Salud !
======================================= PBC - J. Baltasar García Perez-Schofield Dep. Informática, Universidad de Vigo, España (Spain)
On Monday 10 November 2003 08:35, J. Baltasar García Perez-Schofield wrote:
["polygon traits"=>draw(),copy() "prototypical polygon"=>parent,"vertices"]
Slots with names ending in "*" indicate parents.
My question is: How's that possible ? I mean, if the "draw" method is declared in the parent
"traits", then it has no access to the vertices list, as they are declared in the "prototype".
Exactly. Sending 'draw' to 'traits polygon' will get you a "message not understood" error. That really bothers some people, though I don't worry much about it.
So it is impossible to write a complete "draw" method.
Not if you think of 'vertices' as a method instead of an attribute.
I suppose the list of vertices is declared in the "traits" object, at least in a minimalist way, and then repeated in its full format in the prototype polygon.
No, it is not present at all in the traits (and so 'draw' simply doesn't work for that object) but entirely defined in the prototype (so 'draw' does work for it, even though it is actually not defined in that object but inherited from the parent).
Or perhaps the "draw" method in the traits object is an
empty one, and the method is repeated in the polygon prototype object.
Not that either. What you are missing are the advantages of entirely hiding state (attributes) behind behavior (getter and setter methods). For any object that inherits the 'draw' method and also understands the 'vertices' message, 'draw' will work just fine.
-- Jecel
Hi- When you send a 'draw' message to the original object, you access the draw method in the parent, however, it is applied to the original object that has the vertices. David
Jecel Assumpcao Jr wrote:
On Monday 10 November 2003 08:35, J. Baltasar García Perez-Schofield wrote:
["polygon traits"=>draw(),copy() "prototypical polygon"=>parent,"vertices"]
Slots with names ending in "*" indicate parents.
My question is: How's that possible ? I mean, if the "draw" method is declared in the parent
"traits", then it has no access to the vertices list, as they are declared in the "prototype".
Exactly. Sending 'draw' to 'traits polygon' will get you a "message not understood" error. That really bothers some people, though I don't worry much about it.
So it is impossible to write a complete "draw" method.
Not if you think of 'vertices' as a method instead of an attribute.
I suppose the list of vertices is declared in the "traits" object, at least in a minimalist way, and then repeated in its full format in the prototype polygon.
No, it is not present at all in the traits (and so 'draw' simply doesn't work for that object) but entirely defined in the prototype (so 'draw' does work for it, even though it is actually not defined in that object but inherited from the parent).
Or perhaps the "draw" method in the traits object is an
empty one, and the method is repeated in the polygon prototype object.
Not that either. What you are missing are the advantages of entirely hiding state (attributes) behind behavior (getter and setter methods). For any object that inherits the 'draw' method and also understands the 'vertices' message, 'draw' will work just fine.
-- Jecel
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
self-interest@lists.selflanguage.org