[self-interest] Re: Adding method slots dynamically

jbgarcia at uvigo.es jbgarcia at uvigo.es
Wed Aug 17 10:47:39 UTC 2005


Hi, Jecel !

Thank you for your answer.


> > What's the role of the mirror, here ? Is it related to preformance ?
> 
> It isn't a performance issue at all, but rather a matter of good object
> oriented design. The paper I mentioned last month goes into details
> about why mirrors are a good idea (http://bracha.org/mirrors.pdf) but
> here is a short answer:

I've browsed the article and I've also read your answer. Though there isn't
anything wrong in Mirrors for me, I am not totally convinced about them.

If you don't have mirrors, then the functionalty related to reflection (i.e. the
set of methods which actually add methods or attributes, etc.) will be in the
"Object" or however the root of inheritance is named. I suppose this the way
Smalltalk does it, this is the way Java implements it, and anyway it is the way
I am implementing it in Zero ( http://trevinca.ei.uvigo.es/~jgarcia/TO/zero/ ).
The only "bad thing" is that it makes the "Object" object to be quite "big", in
terms of number of methods.

> Every object you create is "about" something. You might create an object
> called "circle" that is about circles on the screen, for example. It
> should know things like its diameter, its center and perhaps stuff about
> its border and interior color. The more we can make ourselfves believe
> that this actually is a circle, the better it will be to work with it.

However, it will always have more functionality than the circle concept has. For
example, you could create another circle sending the message "copy". In order
to follow the path of pureness suggested by the concept of mirrors, perhaps the
copy method should exist in another object of the library, the "factory" object
or something.

So, instead of doing:

myCircle = Circle.copy()

you could do:

myCircle = Factory.copy( Circle )

Or something like that.

> Another advantage of this organization is that just a few
> kinds or mirrors are enough to deal with all objects in Self.

A few kinds of mirrors ? Sorry, I don't understand. Why not a single Mirror
object ?

Salud !

Baltasar



--oOo-----------------------------------------------------------------oOo--

Servicio de acceso ó correo electrónico vía web da Universidade de Vigo
Servicio de acceso al correo electrónico vía web de la Universidad de Vigo

Servicios Informáticos [ http://si.uvigo.es ]
Universidade de Vigo [ http://www.uvigo.es ]

URL: https://correoweb.uvigo.es




More information about the Self-interest mailing list