[self-interest] Re: data structures
Jose' B. Garcia Perez-Schofield
jgarcia at ei.uvigo.es
Wed Jun 9 15:58:15 UTC 1999
> Actually, the solution isn't at all obvious unless you really
> think about it:
>
> (| parent* = traits oddball.
> contents = vector copySize: 3 FillingWith: 0
> |)
>
Thank you very much ! :-)
> In Smalltalk we would do "vector new: 3" since everything is
> initialized with nil, but Self doesn't like defaults and so you
> have to choose some initial value (like 0 in this example)
> explicitly.
It seems that Smalltalk had influented very much in the design of
Self....
>
> (| parent* = traits oddball.
> contents = vector copySize: 3 FillingWith: 0.
> record = (| parent* = (| parent* = traits clonable.
> getAge = (age).
> setAge: x = (Age: x).
> getName: (name).
> setName: x = (name: x) | ).
> age <-0.
> name <- 0. | )
> |)
Ok, ok, you have write in 10 lines what I was proud to get done
in 15 minutes into the environment..... X-DDDDDDDDD
By the way, what abaout the relation between the Self Console and
the graphical environment. If I evaluate the expression '()' in the
console, why the empty object doesn't appear onto the world ?
It seems that the graphical part is very far from textual forms....
>
> You get the idea. You can also build the same object a piece at
> a time graphically, but it would be a bit hard to describe
> textually.
yeah.. I suppose .. ;-)
> contents <- (record copy & record copy & record copy) asVector.
>
> With prototype based programming, it is better if a slot's value
> reflect its intended use at all times, instead of being initialized
> to one thing and then changed to another later.
>
I think so !...
> I hope that helps,
> -- Jecel
>
>
Thank you very much !
Jose
--------------------------------------------------------
An OO surgeon would hand the scalpel to the patient and say:
"now perform this operation on yourself!".
--------------------------------------------------------
PBC -- Jose' Baltasar Garcia Perez-Schofield -- jgarcia at ei.uvigo.es
Escuela Técnica de Informática de Gestión, Universidad de Vigo (Spain).
Dep. Lenguajes y Sistemas Informaticos. Tfno 988-387029
------------------------------------------------------------------------
eGroups.com home: http://www.egroups.com/group/self-interest
http://www.egroups.com - Simplifying group communications
More information about the Self-interest
mailing list