[self-interest] Delegation and Self like things for Squeak

Albertina Lourenci lourenci at lsi.usp.br
Fri Aug 31 12:54:06 UTC 2001


Stephen Pair wrote:
ri, 31 Aug 2001 01:03:08 -0700

Dear Thomas:

I have redirected your message here because  it is not my intention
to knock  any language. I want programming languages to be as good
as the variety of languages around us! My favourite one is German for
example!!! But I would like to know Chinese!!! The pupil of my eyes
is biodiversity treaty!!!

    This sounds great! Java has sort of these facilities. But to program in
    Java is rather nasty! I do not think I am being biased because I do need

    to program with the prototypes!!!

Squeak doesn't have prototypes, but it's a nice system nonetheless.
Give it a try.

Thanks to Stephen Pair Squeak has prototypes now!!Java thanks
to Gunther Kniesel has prototypes too!!! All inspired in Self!!!
Se Kniesel's Lava (Java + prototypes):

http://javalab.cs.uni-bonn.de/research/darwin/

He does a real nice job!!!

However, don't knock Java.  Yes, it is more effort to get stuff
done in it.  On the other hand, when you are dealing with other people's
code, the type checking and extra structure is really a blessing.

Yes , I understand  everybody is striving to deliver more expressive, safe
and efficient
languages and unfortunately  there is no formula to make a language
that is all that at the same time
but ecodesign models  require this at light speed,  thought travels
at a speed higher than light says Jack Sarfatti in his Postquantum
Mechanics!!! So I am sure mankind needs ecodesign modes  at
thought speed!!  This is why I seem agressive!! It is my love for
mankind!!!

Sustainably,
Albertina

Cheers,
Thomas.



> The following is copied from the web page: http://spair.swiki.net/21
> (which also contains screenshot).  It thought it may be of interest
> to the people on this list.
>
> -------------
> === Overview
> This change set adds delegation capabilities to the Squeak VM. It
> also extends some previous work on prototypes by Hans Martin Mosner
> to implement a Self-like (http://self.sunlabs.com) system within
> Squeak.
>
> Delegation is the act of forwarding a message to another object, but
> maintaining the original receiver such that sends to self in the new
> method context will be directed back to the delegating object.
>
> === Screenshot
> The following screenshot shows ProtoInspectors open on a family
> (literally) of objects. They are arranged according to their
> inheritance hierarchy. Slots with an asterisk denote parent slots
> (their behavior is inherited by the child). The image doesn't show
> it, but you may have any number of parent slots.
>
>  <<see web page: http://spair.swiki.net/21>>
>
> === Implementation Details
> Two new bytecodes are added to the VM:
>
> singleExtendedDelegateBytecode
> doubleExtendedDelegateBytecode
> (but the compiler has not yet been modified to generate these
> bytecodes)
>
> Several new primtives are added to support delegation and reflection
>
> primitiveDelegate - added to Object as #delegate:,
> #delegate:with:, ...etc
> primitiveDelegateArgs - added to Object as #delegate:withArguments:
>
> The following primitives allow a Mirror to reflect on objects without
> needing to send messages to the reflectee (this allows mirror to
> manipulate objects that may have a very lightweight protocol):
>
> primitiveGetSlots
> primitiveSetSlots
> primitiveGetProtoBehavior
> primitiveSetProtoBehavior
>
> The message lookup algorithm is also modified to search the parent
> slots of objects whos class is an instance of ProtoBehavior. This
> allows for instance based, multiple inheritance.
>
> Bytecodes accessing the internal structure of an object
> (pushReceiverVariable and kin) are modified such that the look to
> the "receiverStorage" object in the active context. In normal
> messages receiverStorage is identical to receiver, but in delegated
> methods, they will be different.
>
> You may create object that inherit behavior from normal Smalltalk
> instances (direct instance variable manipulation will affect the
> parent object, not the child's slots).
>
> Hans Martin Mosner's HmmProtoObject class has been dropped in favor
> of the Mirror class and a reflection based approach to meta-
> programming in the spirit of Self. To add or remove slots or methods,
> you must use a mirror (unless you add methods to your instance). The
> ProtoInpector now uses a Mirror to manipulate an object. This allows
> objects to be inspected and manipulated even if they have no behavior.
>
> The VM has also been enhanced such that a recursive
> #doesNotUnderstand: will not crash the image, but lookup the
> #doesNotUnderstand: on Object (and you will get a #doesNotUnderstand:
> on a #doesNotUnderstand: message). This was done because the
> likelyhood of accidentally creating objects that don't understand
> #doesNotUnderstand: has increased dramatically with the introduction
> of ProtoBehavior.
>
> There should now be enough support in the VM to implement a pretty
> robust implementation of Self within Squeak. It would be really cool
> to see the Self tools for manipulating objects recreated in Squeak.
>
> === Issues
> The compiler has not been modified in any way, shape or form to
> implement anything like the Self syntax. This means that doing
> certain things can be awkward. Additionally, this means that you must
> use #delegate: or one of it's variants in order to accomplish what
> Self calls a "resend." Also, only a directed resend is possible.
>
> There is no way to store instance based source code, therefore, all
> methods appear in their de-compiled form. This is a pain.
>
> === Downloading
> There are three things that you can download:
>
> 1. A bundle that includes a demo image, changes file, and a Win32 VM
> 2. Just the change set (you will need to compile your own VM and
> follow the procedure below to get an existing image prepared to run
> on it) 3. Just the win32 VM (note, trying to run a base Squeak image
> on this VM won't get you very far very fast)
>
> If you are going to compile you own VM, you will need to load the
> change set, and then execute the following code in a workspace to
> prepare the existing method contexts in your image:
>
> MethodContext allInstances do:
>   [ :ea | ea instVarNamed: #receiverMap put: ea receiver ]. Smalltalk
> snapshot: true andQuit: true.
>
> Then, you should have an image that will work on your new VM with
> support for delegation.
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

--
.----------------------------------------------------------.
| Albertina Lourenci                                       |
| PhD  in Architecture and Urbanism                        |
| post-doctorate researcher                                |
| Laboratory of Integrated Systems University of Sao Paulo |
| Avenida Professor Luciano Gualberto, 158 Travessa 3      |
| CEP: 05508-900                                           |
| Sao Paulo Sao Paulo State Brazil                         |
| Voice: +55 011 818 5254                                  |
| Fax: +55 11 211 4574                                     |
.----------------------------------------------------------.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.selflanguage.org/pipermail/self-interest/attachments/20010831/3d299ed7/attachment.html>


More information about the Self-interest mailing list