<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>

<META content="MSHTML 6.00.2712.300" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><SPAN class=225455519-10052002><FONT face=Arial color=#0000ff size=2>You 
just need to look at the Interpreter class.&nbsp; The Squeak VM is mostly 
written in Smalltalk and translated into C.&nbsp; You are right that the Squeak 
VM is not reflective enough to allow you to customize message dispatch without 
building a new VM.&nbsp; This is due to performance optimization, as well as 
experimentation with previous versions of Smalltalk that did allow some degree 
of this capability.&nbsp; There has been some discussion of allowing one to add 
a special method that, when present, will receive all messages directed at an 
object (prior to any lookup).&nbsp; These types of things could certainly be 
handy when you're trying to precisely replicate the protocol supported by some 
other object (among other things).&nbsp; </FONT></SPAN></DIV>
<DIV><SPAN class=225455519-10052002><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=225455519-10052002><FONT face=Arial color=#0000ff 
size=2>Conceivably, you wouldn't even necessarily need to restrict yourself to 
traditional message selectors...for example, you could send an arbitrary string 
of text to an object and let it figure out how to interpret it.&nbsp; I think 
one of the old Smalltalks had this capability.&nbsp; However, most of the 
comments about it seemed to indicate that it led to a Tower of Babel issue and 
didn't turn out to be as useful as originally thought.</FONT></SPAN></DIV>
<DIV><SPAN class=225455519-10052002><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN><SPAN class=225455519-10052002><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=225455519-10052002><FONT face=Arial color=#0000ff size=2>- 
Stephen</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT 
  face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> 
  squeak-dev-admin@lists.squeakfoundation.org 
  [mailto:squeak-dev-admin@lists.squeakfoundation.org] <B>On Behalf Of 
  </B>Jessie Dedecker<BR><B>Sent:</B> Friday, May 10, 2002 3:02 PM<BR><B>To:</B> 
  squeak-dev@lists.squeakfoundation.org<BR><B>Subject:</B> Re: question about 
  method dispatch<BR><BR></FONT></DIV>
  <DIV><FONT face=Arial size=2>Hello again,</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>thanks for replying so soon :)</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>I already took the optional of the 
  #doesNotUnderstand: method into account, however I would like to change the 
  dispatch for &lt;all&gt; objects and &lt;all&gt; messages, also existing 
  ones.</FONT></DIV>
  <DIV><FONT face=Arial size=2>But if I understood you correctly there is no way 
  to change the dispatch using the reflective capabilities of Smalltalk?&nbsp; 
  So I should start looking at the C-code instead or did I understood it 
  incorrectly?</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>Thanks,</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>Jessie Dedecker</FONT></DIV>
  <BLOCKQUOTE dir=ltr 
  style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
    <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
    <DIV 
    style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
    <A title=spair@advantive.com href="mailto:spair@advantive.com">Stephen 
    Pair</A> </DIV>
    <DIV style="FONT: 10pt arial"><B>To:</B> <A 
    title=squeak-dev@lists.squeakfoundation.org 
    href="mailto:squeak-dev@lists.squeakfoundation.org">squeak-dev@lists.squeakfoundation.org</A> 
    </DIV>
    <DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, May 10, 2002 3:46 
PM</DIV>
    <DIV style="FONT: 10pt arial"><B>Subject:</B> RE: question about method 
    dispatch</DIV>
    <DIV><BR></DIV>
    <DIV><SPAN class=997513718-10052002><FONT face=Arial color=#0000ff size=2>If 
    I understand your question correctly, you cannot change the method dispatch 
    algorithm in Squeak without modifying the VM.&nbsp; However, you can 
    simulate a custom dispatch algorithm using the #doesNotUnderstand: 
    method.&nbsp; That method gives you an instantiated message object and you 
    are free to interpret the message any way you like.&nbsp; The downside is 
    that it's slower, and any actual methods implemented on your object will 
    mask the #doesNotUnderstand: method (#doesNotUnderstand: is sent whenever 
    the VM cannot find a method in the method dictionary (or a superclass' 
    method dictionary) that matches the selector).&nbsp; The argument is a 
    reified version of the message that was sent, but not understood (hence the 
    name).&nbsp; Have a look at Interpreter&gt;&gt;internalFindNewMethod (and 
    related methods) to see where the VM implements the dispatch 
    algorithm.</FONT></SPAN></DIV>
    <DIV><SPAN class=997513718-10052002><FONT face=Arial color=#0000ff 
    size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV><SPAN class=997513718-10052002><FONT face=Arial color=#0000ff size=2>- 
    Stephen</FONT></SPAN></DIV>
    <BLOCKQUOTE dir=ltr 
    style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
      <DIV></DIV>
      <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT 
      face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> 
      squeak-dev-admin@lists.squeakfoundation.org 
      [mailto:squeak-dev-admin@lists.squeakfoundation.org] <B>On Behalf Of 
      </B>Jessie Dedecker<BR><B>Sent:</B> Friday, May 10, 2002 2:36 
      PM<BR><B>To:</B> squeak-dev@lists.squeakfoundation.org<BR><B>Subject:</B> 
      question about method dispatch<BR><BR></FONT></DIV>
      <DIV><FONT face=Arial size=2>Hello,</FONT></DIV>
      <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
      <DIV><FONT face=Arial size=2>could anyone please tell me how I can change 
      the method dispatch in smalltalk.&nbsp; I tried to change the 
      ContextPart&gt;&gt;send:super:numArgs: but I guess</FONT></DIV>
      <DIV><FONT face=Arial size=2>this doesn't work because of optimisations 
      that were performed.</FONT></DIV>
      <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
      <DIV><FONT face=Arial size=2>Is there a way to change the 
      dispatch?</FONT></DIV>
      <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
      <DIV><FONT face=Arial size=2>Thanks,</FONT></DIV>
      <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
      <DIV><FONT face=Arial size=2>Jessie 
  Dedecker</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>