<br><br><div class="gmail_quote">On Sun, May 2, 2010 at 10:32 AM, Chris Cunnington <span dir="ltr">&lt;<a href="mailto:smalltalktelevision@gmail.com">smalltalktelevision@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><span style="font-family:&#39;Courier New&#39;, Courier, Fixed;font-size:13px;color:rgb(51, 51, 51)"><pre style="font-size:12px">Editor class&gt;&gt;blinkingCursor
        &lt;preference: &#39;Blinking Text Cursor&#39;
                category: &#39;Morphic&#39;
                description: &#39;When true, the text cursor will blink.&#39;
                type: #Boolean&gt;
        ^ BlinkingCursor ifNil: [ true ]</pre></span></div><div><br></div><div>1. compile method (i.e. x := Editor class compiledMethodAt: #blinkingCursor) </div><div><br></div><div>2. compiled method is sent #pramas message to see if it has any (i.e. x pragmas) </div>


<div><br></div><div>3. it does, so they are executed as a message send before the rest of the method is executed (i.e. <span style="font-family:monospace;font-size:12px;color:rgb(51, 51, 51);white-space:pre">^ BlinkingCursor ifNil: [ true ])</span></div>


<div><br></div><div>4. this changes the context of the system in anticipation of the code in the method</div><div><br></div><div>For example, Editor class #blinkingCursor will set a Preference in the system before the rest of the method executes </div>


<div><br></div><div>Problem: How does the System know the receiver the pragma message is supposed to be sent to? Usually, we have a class, we send a message, and return an error if the class doesn&#39;t have that selector.</div>


<div><br></div><div>Here, we only have a method, no specified class. The pragma messages are all unique, they only exist in one class in the system. Perhaps the system identifies the receiver by the uniqueness of the message, and then sends it. </div>


<div><br></div><div>Only Preferences is going to have preference:category:description:type:</div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><br>
</div><div>Therefore, pragma messages are not polymorphic, because they are only ever defined in a single class (i.e. #primitive: or #primitive:error: in Parser) </div></blockquote><div><br></div><div>In this case but not necessarily.  I can imagine a polymorphic implementation of documentaion pragmas for example. </div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div><br></div><div>A package is installed. It doesn&#39;t register its needs. The system does so by sending the #pragmas message to compiled methods of the package to be present a list of pragmas. It looks at the returned list, makes a decision, and executes one (or all) of the pragmas as a message to a receiver. Thus, the System context is changed and the package can then proceed. </div>


<div><br></div><div>What is it I&#39;m not getting here? I still don&#39;t understand how a receiver presents itself to receive the selector in the pragma. Any help would be greatly appreciated. </div></blockquote><div><br>
</div><div>Some event causes some object to go search for methods containing specific pragmas and to apply those pragmas to some given object.  In the above case the implementor is Preferences class and the receiver is Preferences and, as Bert says, the event casing the trawl is Preferences class&gt;&gt;prefEvent:.  See Preferences class&gt;&gt;registerForEvents: for the hookup that sends prefEvent: whenever a method is added or removed.</div>
<div><br></div><div>So let&#39;s revisit your list:</div><div><br></div><div>0. an object (typically a class) that wants to respond to pragmas^H^H^H^H^H^H^H method tags uses some means for being notified of method additions and removals.</div>
<div><br></div><div>1. <span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">compile method (i.e. x := Editor class compiledMethodAt: #blinkingCursor) </span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">2. the class (and possibly others uninterested in this specific method tag) is notified of the method addition via an event</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><span class="Apple-style-span" style="font-size: 13px; "><div>
3. compiled method is sent #pramas message to see if it has any (i.e. x pragmas) by the class which<span class="Apple-style-span" style="font-size: small; "> (in this case) performs the method tag to obtain the preference and stores it in the perferences dictionary under the method&#39;s selector.</span></div>
<div><span class="Apple-style-span" style="font-size: small;"><br></span></div><div><span class="Apple-style-span" style="font-size: small;"><br></span></div><div><span class="Apple-style-span" style="font-size: small;"><br>
</span></div><div><span class="Apple-style-span" style="font-size: small;">There are some implications for package loading such as Monticello.  It is convenient if e.g. a Monticello load, which is essentially a bulk compile, class hierarchy edit and method remove step, batch the events until after the entire package is loaded/updated.  For example, a menu method tag that specifies an entry in a menu for a particular selector might include an icon name for the menu entry and depending on package load order the icon method may not have been compiled yet if the method tag is processed immediately the method is compiled.  If notifications are deferred until the entire package has been processed then there&#39;s no problem.  At least that was our experience with VisualWorks.</span></div>
</span></span></font></div><div> </div><div><br></div><div>best</div><div>Eliot</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><br></div><font color="#888888"><div>Chris </div>
</font><br><br>
<br></blockquote></div><br>