<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>RE: Reflection in Squeak (was: RE: [GOODIE] Delegation and Self like things for Squeak)</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>:-)&nbsp; Now add pumped message queues and future that reply value/exception to the sending queue. The queues are bound to a particular process (MorphicTask/Task) enabled by dynamically sending aSecretary foreground or aSecretary background.&nbsp;&nbsp; I need to sort out a viable impl.&nbsp; (avoiding IP issues)</FONT></P>

<P><FONT SIZE=2>Ahh..I just noticed your other message...been there, done that!&nbsp; ;-)</FONT>
</P>

<P><FONT SIZE=2>I like to think of Spaces having different properties, and the external references would build appropriate access actions based on those properties.&nbsp; For instance: remote, persistent, different language environment...</FONT></P>

<P><FONT SIZE=2>more below</FONT>
</P>

<P><FONT SIZE=2>&gt; -----Original Message-----</FONT>
<BR><FONT SIZE=2>&gt; From: Stephen Pair [<A HREF="mailto:spair@advantive.com">mailto:spair@advantive.com</A>]</FONT>
<BR><FONT SIZE=2>&gt; Sent: Wednesday, August 22, 2001 12:55 PM</FONT>
<BR><FONT SIZE=2>&gt; To: squeak-dev@lists.squeakfoundation.org</FONT>
<BR><FONT SIZE=2>&gt; Subject: RE: Reflection in Squeak (was: RE: [GOODIE] </FONT>
<BR><FONT SIZE=2>&gt; Delegation and Self</FONT>
<BR><FONT SIZE=2>&gt; like things for Squeak)</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; Whoa!!!!!!!</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; I suddenly see what your after...incredible!&nbsp; If you further associate</FONT>
<BR><FONT SIZE=2>&gt; the current space with a Process (and switch this out when crossing</FONT>
<BR><FONT SIZE=2>&gt; boundaries), then you can, at all times, know what space the receiver</FONT>
<BR><FONT SIZE=2>&gt; currently resides (sort of an optimization of every object holding a</FONT>
<BR><FONT SIZE=2>&gt; reference to the space).&nbsp; If you clamp down (security wise) on</FONT>
<BR><FONT SIZE=2>&gt; reflection, especially on these boundary references and on </FONT>
<BR><FONT SIZE=2>&gt; Process...you</FONT>
<BR><FONT SIZE=2>&gt; should have everything you need to implement a security </FONT>
<BR><FONT SIZE=2>&gt; mechanism (among</FONT>
<BR><FONT SIZE=2>&gt; other things).&nbsp; Each user could have a number of spaces, each with</FONT>
<BR><FONT SIZE=2>&gt; different security settings, and the ability to move owned </FONT>
<BR><FONT SIZE=2>&gt; objects from</FONT>
<BR><FONT SIZE=2>&gt; one space to another.&nbsp; Using this mechansim, you could </FONT>
<BR><FONT SIZE=2>&gt; specify security</FONT>
<BR><FONT SIZE=2>&gt; down to the individual method level if that's what you need (then you</FONT>
<BR><FONT SIZE=2>&gt; would have one space for one object).&nbsp; This would be an optimized</FONT>
<BR><FONT SIZE=2>&gt; implementation of a security mechanism where every object </FONT>
<BR><FONT SIZE=2>&gt; held it's own</FONT>
<BR><FONT SIZE=2>&gt; security context.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; The other thing that suddenly becomes possible is running </FONT>
<BR><FONT SIZE=2>&gt; multple VMs in</FONT>
<BR><FONT SIZE=2>&gt; one object memory (to take advantage of SMP) or running a distributed</FONT>
<BR><FONT SIZE=2>&gt; system where some objects are in a different physical object </FONT>
<BR><FONT SIZE=2>&gt; memory (but</FONT>
<BR><FONT SIZE=2>&gt; I think that's exactly what you're after, is it not).</FONT>
</P>

<P><FONT SIZE=2>Sure, why not.&nbsp; Multiple ObjectMemories is an idea with shared GC&nbsp; (first come, first serve?) and SharedObjectMemory, between 2 OS Processes.</FONT></P>

<P><FONT SIZE=2>&gt; You have everything you need to mock it up now.&nbsp; There are two things</FONT>
<BR><FONT SIZE=2>&gt; that I can think of to watch out for:</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; - Messages that are not really sent, but optimized in bytecodes (i.e.</FONT>
<BR><FONT SIZE=2>&gt; #class)</FONT>
</P>

<P><FONT SIZE=2>Mmm...yes, a problem.&nbsp; I was thinking that when a JIT arrives, that we can let that do inlining.&nbsp; For that matter, what are the implications of delegation with Jitter?</FONT></P>

<P><FONT SIZE=2>&gt; - Messages in ProtoObject (you could probably re-work the </FONT>
<BR><FONT SIZE=2>&gt; users of these</FONT>
<BR><FONT SIZE=2>&gt; messages such an object responding to nothing could live nicely in</FONT>
<BR><FONT SIZE=2>&gt; squeak...you could use Bob's technique for putting those </FONT>
<BR><FONT SIZE=2>&gt; primitives on a</FONT>
<BR><FONT SIZE=2>&gt; different object)</FONT>
</P>

<P><FONT SIZE=2>sigh...yes, this is the last core step I think.&nbsp; I didn't really understand Bob's example with &lt;primitive:1&gt; since I really wanted is:</FONT></P>

<P><FONT SIZE=2>addNum1: num1 num2: num2</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>&lt;multimethodPrimitive: 1&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>^ self primitiveFailed</FONT>
</P>

<P><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>&gt; - Stephen</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; P.S. in the Kats stuff, there is a modification to Process to allow it</FONT>
<BR><FONT SIZE=2>&gt; to carry process specific contexts...it's also in Comanche</FONT>
</P>

<P><FONT SIZE=2>Yes!&nbsp; I have a SecretaryMap, with a default global secretary in the foreground.&nbsp; This allows me to pump the queues and stay process loyal.&nbsp; In my testing, I can run thousands of simultaneous asynchronous tasks (in the background) and print to the Transcript without problems (well, morphic refresh of overlapped windows causes problems).&nbsp; All garbage is cleaned up, too.</FONT></P>

<P><FONT SIZE=2>I am really happy that we are on the minnd meld, now.&nbsp; I have such difficulty in explaining what I envision.&nbsp; Thanks!</FONT>
</P>

<P><FONT SIZE=2>- Rob</FONT>
<BR><FONT SIZE=2>&nbsp;</FONT>
<BR><FONT SIZE=2>&gt; - Stephen</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; -----Original Message-----</FONT>
<BR><FONT SIZE=2>&gt; From: squeak-dev-admin@lists.squeakfoundation.org</FONT>
<BR><FONT SIZE=2>&gt; [<A HREF="mailto:squeak-dev-admin@lists.squeakfoundation.org">mailto:squeak-dev-admin@lists.squeakfoundation.org</A>] On Behalf Of</FONT>
<BR><FONT SIZE=2>&gt; Withers, Robert</FONT>
<BR><FONT SIZE=2>&gt; Sent: Wednesday, August 22, 2001 11:24 AM</FONT>
<BR><FONT SIZE=2>&gt; To: 'squeak-dev@lists.squeakfoundation.org'</FONT>
<BR><FONT SIZE=2>&gt; Subject: RE: Reflection in Squeak (was: RE: [GOODIE] </FONT>
<BR><FONT SIZE=2>&gt; Delegation and Self</FONT>
<BR><FONT SIZE=2>&gt; like things for Squeak)</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; also embedded. </FONT>
<BR><FONT SIZE=2>&gt; &gt; -----Original Message----- </FONT>
<BR><FONT SIZE=2>&gt; &gt; From: Stephen Pair [<A HREF="mailto:spair@advantive.com">mailto:spair@advantive.com</A>] </FONT>
<BR><FONT SIZE=2>&gt; &gt; Sent: Wednesday, August 22, 2001 7:39 AM </FONT>
<BR><FONT SIZE=2>&gt; &gt; To: squeak-dev@lists.squeakfoundation.org </FONT>
<BR><FONT SIZE=2>&gt; &gt; Subject: Reflection in Squeak (was: RE: [GOODIE] Delegation </FONT>
<BR><FONT SIZE=2>&gt; and Self </FONT>
<BR><FONT SIZE=2>&gt; &gt; like things for Squeak) </FONT>
<BR><FONT SIZE=2>&gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; See embedded comments. </FONT>
<BR><FONT SIZE=2>&gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; -----Original Message----- </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; From: squeak-dev-admin@lists.squeakfoundation.org </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; [<A HREF="mailto:squeak-dev-admin@lists.squeakfoundation.org">mailto:squeak-dev-admin@lists.squeakfoundation.org</A>] On </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; Behalf Of Rob Withers </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; Sent: Wednesday, August 22, 2001 3:40 AM </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; To: squeak-dev@lists.squeakfoundation.org </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; Subject: Re: [GOODIE] Delegation and Self like things for Squeak </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; oops.&nbsp; I wrote: </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; &gt; Mirror would implement </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; &gt; ------ </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; &gt; delegate: selector arguments: argArray </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; ^ self reflectee delegate: selector arguments: argArray </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; &gt; ----- </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; but this doesn't do it.&nbsp; I wanted to execute the delegate </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; primitive, without implementing #delegate:arguments: in the </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; Forwarder (that may be chained). Additionally, creating a </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; mirror will slow it down. </FONT>
<BR><FONT SIZE=2>&gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; Right...we would need a new delegate primitive that didn't </FONT>
<BR><FONT SIZE=2>&gt; require a </FONT>
<BR><FONT SIZE=2>&gt; &gt; message to be installed on the target (see more on this </FONT>
<BR><FONT SIZE=2>&gt; &gt; below).&nbsp; But, we </FONT>
<BR><FONT SIZE=2>&gt; &gt; do have the delegate bytecodes!&nbsp; You could doctor up a </FONT>
<BR><FONT SIZE=2>&gt; &gt; CompiledMethod to </FONT>
<BR><FONT SIZE=2>&gt; &gt; do what you need (the compiler won't generate any delegate </FONT>
<BR><FONT SIZE=2>&gt; bytecodes </FONT>
<BR><FONT SIZE=2>&gt; &gt; just yet...and I'm not going to make it do so anytime </FONT>
<BR><FONT SIZE=2>&gt; soon)...in fact,</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; the delegate bytecode would be the fastest solution and </FONT>
<BR><FONT SIZE=2>&gt; &gt; wouldn't require </FONT>
<BR><FONT SIZE=2>&gt; &gt; a new primitive.&nbsp; Also, don't forget about &quot;Mirror on: </FONT>
<BR><FONT SIZE=2>&gt; &gt; someObject&quot; which </FONT>
<BR><FONT SIZE=2>&gt; &gt; avoids sending the #mirror message (in case you don't want to </FONT>
<BR><FONT SIZE=2>&gt; &gt; implement </FONT>
<BR><FONT SIZE=2>&gt; &gt; #mirror in your object).&nbsp; If you are chaining these things, </FONT>
<BR><FONT SIZE=2>&gt; then you </FONT>
<BR><FONT SIZE=2>&gt; &gt; probably would want to work through a mirror...you can avoid </FONT>
<BR><FONT SIZE=2>&gt; &gt; creating a </FONT>
<BR><FONT SIZE=2>&gt; &gt; mirror on every message if you hold onto the mirror instead of the </FONT>
<BR><FONT SIZE=2>&gt; &gt; target object. </FONT>
<BR><FONT SIZE=2>&gt; I'm with you here...An example of doing this is in </FONT>
<BR><FONT SIZE=2>&gt; ProtoBehavior, where</FONT>
<BR><FONT SIZE=2>&gt; you define the accessor and mutator methods for a new slot</FONT>
<BR><FONT SIZE=2>&gt; (compileSlot:...).&nbsp; That's some interesting code!&nbsp; </FONT>
<BR><FONT SIZE=2>&gt; This architecture of chaining managed references, especially </FONT>
<BR><FONT SIZE=2>&gt; now that we</FONT>
<BR><FONT SIZE=2>&gt; ought to use a Mirror, was why I wanted the thinnest possible managed</FONT>
<BR><FONT SIZE=2>&gt; reference.&nbsp; Let's take three spaces (A, B, C) and an object </FONT>
<BR><FONT SIZE=2>&gt; (a) in space</FONT>
<BR><FONT SIZE=2>&gt; A.&nbsp; If we export the reference to space B, then we want to manage the</FONT>
<BR><FONT SIZE=2>&gt; reference with an access manager to Space A.&nbsp; So in space B, the</FONT>
<BR><FONT SIZE=2>&gt; reference to a would be Forwarder to Space A manager on a, configured</FONT>
<BR><FONT SIZE=2>&gt; for access from B, </FONT>
<BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Fb(a) := F(B-&gt;a) := F(Ma(B), a).&nbsp; </FONT>
<BR><FONT SIZE=2>&gt; If Space B then passes this reference to C, then we would have:&nbsp; </FONT>
<BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Fc(Fb(a)) := F(C-&gt;F(B-&gt;a)) := F(Mb(C), Fb(a)).&nbsp; It </FONT>
<BR><FONT SIZE=2>&gt; would be nice</FONT>
<BR><FONT SIZE=2>&gt; if we could resolve this to: Fc(a), since they ought to be identical,</FONT>
<BR><FONT SIZE=2>&gt; and since there is no aspect of B filtering access to Fa.&nbsp; Of course</FONT>
<BR><FONT SIZE=2>&gt; there could be, if the access priviledges are degraded for </FONT>
<BR><FONT SIZE=2>&gt; C's use of B</FONT>
<BR><FONT SIZE=2>&gt; references - C may not be able to access A.</FONT>
<BR><FONT SIZE=2>&gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; Is there a way to invoke a primitive against a different </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; receiver, in Squeak?&nbsp; For example, In a doIt, invoke </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; &lt;primitive: 1&gt; and supply the 2 numbers - one the receiver </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; and the other the argument. </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; &gt; - Rob </FONT>
<BR><FONT SIZE=2>&gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; No...not unless you write a new primitive...which is what </FONT>
<BR><FONT SIZE=2>&gt; &gt; I've done for </FONT>
<BR><FONT SIZE=2>&gt; &gt; a few things that are required by Mirror to avoid sending a </FONT>
<BR><FONT SIZE=2>&gt; message to</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; the reflectee.&nbsp; In fact, there are a lot of things that you </FONT>
<BR><FONT SIZE=2>&gt; might want</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; to invoke in this way.&nbsp; I'm starting to believe that a lot </FONT>
<BR><FONT SIZE=2>&gt; of the very</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; basic primitives should be re-implemented such that they do </FONT>
<BR><FONT SIZE=2>&gt; &gt; not require </FONT>
<BR><FONT SIZE=2>&gt; &gt; that the method be installed the subject.&nbsp; However, this </FONT>
<BR><FONT SIZE=2>&gt; allows one to</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; break encapsulation...but if we could find some way for an </FONT>
<BR><FONT SIZE=2>&gt; object to </FONT>
<BR><FONT SIZE=2>&gt; &gt; restrict (or disable entirely) who is allowed to use reflection </FONT>
<BR><FONT SIZE=2>&gt; &gt; primitives against it, I think it just may be the way to go. </FONT>
<BR><FONT SIZE=2>&gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; Right...Primitives shouldn't push the receiver, but rather </FONT>
<BR><FONT SIZE=2>&gt; that would be</FONT>
<BR><FONT SIZE=2>&gt; an explicit argument to the primitive method context.&nbsp; Nice.</FONT>
<BR><FONT SIZE=2>&gt; cheers, </FONT>
<BR><FONT SIZE=2>&gt; Rob </FONT>
<BR><FONT SIZE=2>&gt; &gt; There are some basic operations in Squeak that require the </FONT>
<BR><FONT SIZE=2>&gt; ProtoObject</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; protocol, those operations could be re-written such that if </FONT>
<BR><FONT SIZE=2>&gt; &gt; the message </FONT>
<BR><FONT SIZE=2>&gt; &gt; they are sending isn't implemented, then they fall back on a </FONT>
<BR><FONT SIZE=2>&gt; &gt; reflection </FONT>
<BR><FONT SIZE=2>&gt; &gt; primitive (like #== for example).&nbsp; Certain operations that </FONT>
<BR><FONT SIZE=2>&gt; really need</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; the method natively implemented would not send the message to </FONT>
<BR><FONT SIZE=2>&gt; &gt; the object </FONT>
<BR><FONT SIZE=2>&gt; &gt; at all, and use the reflection primitive instead (like </FONT>
<BR><FONT SIZE=2>&gt; #nextObject for</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; example...that one absolutely has to return an answer </FONT>
<BR><FONT SIZE=2>&gt; appropriate for </FONT>
<BR><FONT SIZE=2>&gt; &gt; itself, or infinite looping can happen (or inaccurate </FONT>
<BR><FONT SIZE=2>&gt; results from a </FONT>
<BR><FONT SIZE=2>&gt; &gt; references search)). </FONT>
<BR><FONT SIZE=2>&gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; - Stephen </FONT>
<BR><FONT SIZE=2>&gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; &gt; </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; </FONT>
</P>

</BODY>
</HTML>