<meta http-equiv="Content-Type" content="text/html charset=windows-1250">Also i have more 'intel' on the problem form questions i posted elsewhere.<div><br></div><div>I will serve as a conduit for this and try to keep every place update to the latest developments. In the end i think it will create a kind of cohesion between ideas, hopefully enough to generate something real.</div><div><br></div><div>Here goes:</div><div><br></div><div><span class="Apple-tab-span" style="font-weight: bold; white-space: pre; ">        </span><b>First advice:&nbsp;<i>You should use the debugger to go to the "edge" of the logic inside your code and "code from there" onwards.</i></b></div><div>"<font size="1">The easiest way to figure that out is to debug the code and follow the execution step by step.&nbsp;</font></div><div><font size="1"><br>Note that you can basically develop in the debugger, unlike most other programming languages!&nbsp;<br><br>There are two ways to launch the debugger:&nbsp;<br>1. put a "self halt" in the code, this is the Smalltalk way of adding a breakpoint&nbsp;<br>2. Select a piece of code and debug it, right click and select debug&nbsp;"</font></div><div><br></div><div><span class="Apple-tab-span" style="font-weight: bold; white-space: pre; ">        </span><b>Second advice:&nbsp;<i>It should make execution clear to the user.</i></b></div><div><br></div><div><font size="1">"Essentially showing the execution order of any smalltalk code. I wanted to use the "way" pharo works itself to do this… instead of parsing the text myself and checking.</font></div><font size="1">For example… in the Workspace… i can write a small piece of code that does something. When i select it and click Do It. Pharo goes on to execute the text… it first parses it i think and then figures out what to execute first and then pass the product of that object to the next thing and so on.<br>It might look like this<br><br>something dothis.<br>anotherobject something dothis.<br>finalobject [ anotherobject something do this ]."</font><div><font size="1"><br></font></div><div><span class="Apple-tab-span" style="font-weight: bold; white-space: pre; ">        </span><b>Third advice: <i>Go in and do this after the code is compiled, this will give exact data of that the code really compiles to and not just a layer that parses text.</i></b></div><div><font size="1">"</font><a href="http://smalltalkhub.com/#!/~dh83/ast-interpreter" target="_top" rel="nofollow" link="external" style="font-size: x-small; ">http://smalltalkhub.com/#!/~dh83/ast-interpreter</a></div><div><font size="1"><br>There is a configuration and a lot of tests which document how it works.&nbsp;<br>There you have complete control over what is executed where.&nbsp;<br>Simply override the method that handles sends and you should be able to easily add the things you want."</font></div><div><font size="1"><br></font></div><div><span class="Apple-tab-span" style="font-weight: bold; white-space: pre; ">        </span><b>Forth advice:&nbsp;<i>Showing the execution order as you create code, should also work for illegal code so you can can create without the backfire of an error (works best with dynamically typed languages) and this to be done "debugger" style at the very edge of the logic in your code, this is where you create… and should have a free but "helped and guided" hand.</i></b></div><div><br></div><div><font size="1">"1. If you want to show the order of the messages sent *without* actually&nbsp;<br>executing the code you need to compile the code and inspect the AST.&nbsp;<br>This is not that hard to do.&nbsp;<br><br>2. If you want to visualize the order while executing it - you could&nbsp;<br>look at how Debugger works and simply "debug" the code programmatically.&nbsp;<br>It basically means spawning a Process and sending "step" to it over and&nbsp;<br>over and looking at where it is etc. Funky enough the Debugger is "just&nbsp;<br>Smalltalk code". :)&nbsp;</font></div><div><font size="1"><br></font></div><div><font size="1">But what happens if the code does not exist, class names are not valid, method names are just examples.<br><br>If i were to analyze something like an example someone has posted somewhere.</font></div><div><font size="1"><br></font></div><div><font size="1">In Squeak I can't say, but in Pharo, the Compiler can be "stupid" and compile more or less everything :)&nbsp;</font></div><div><font size="1"><br></font></div><div><font size="1">So to get this "execution order" and no run-time errors... i would need to get behind the complier and before the code actually runs. I don't want it to bump up errors but rather just "mark" the code, in a manner similar to code highlighting but not at the character/word level but at language level.&nbsp;"</font><br><div><br></div><div><span class="Apple-tab-span" style="font-weight: bold; white-space: pre; ">        </span><b>The AST-Interpreter part: <i>It seems we can do this with the help of the AST, which has a certain implementation that requires a precise pattern of interaction, and it's called the "visitor pattern". I also received a bump in the direction of "Moose and friends (Roasal, PetitParser, ..&nbsp;)" which might shed a little more light on the subject.</i></b></div><div><br></div><div><div><font size="1">"You would need to write something like this (a visitor) or use the AST interpreter (which</font></div><div><font size="1">is just a fancy visitor)."</font></div></div><div><font size="1"><br></font></div><div><font size="1">" Execute&nbsp;(Point&gt;&gt;#x) parseTree explore&nbsp;</font></div><div><font size="1">in the Workspace to see a little of AST's power of going into classes and check out below for a more detailed information</font></div><div><div><font size="1">(Point&gt;&gt;#x) "==&gt; (Point&gt;&gt;#x "a CompiledMethod(880017408)")"</font></div><div><font size="1"><br></font></div><div><font size="1">#aSymbol is just a singletone version of the string "aSymbol"; In what to classes concerns it is used as a unique identifier in the method dictionary. The rest is just syntax "&gt;&gt;" is the selector(s) (method(s)) &nbsp;accessor, it will retrieve the keyed selector (in this case #x which again is unique in the class) value, which is a CompiledMethod(atSomeAddress).&nbsp;</font></div><div><font size="1"><br></font></div><div><font size="1">Now you can also get the contents &nbsp;as a string if you want to parse it yourself (compare to (Point&gt;&gt;#x) parseTree ):</font></div><div><font size="1"><br></font></div><div><font size="1">(Point&gt;&gt;#x) definition "==&gt;&nbsp;'x</font></div><div><font size="1"><span class="" style="white-space: pre; ">                                         </span>"Answer the x coordinate."</font></div><div><font size="1"><span class="" style="white-space: pre; ">                                              </span>^x'"</font></div><div><font size="1">Which is nothing more than the contents of the selector #x. I suggest, if you want to get a "personalized" version of the parse tree, to try PetitParser, there are many examples and even a Smalltalk80 parser in there."</font></div></div><div><br></div><div>PS. I will try to build a wiki to host this on a server so we can have a central reference. Right now i will have to keep things in sync by hand.</div><div>PPS. I will try to keep a reference of who said what so that we can see ideas from multiple people merging to a coherent solution.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><div><div>Pe 28.01.2013, la 18:09, dcorking [via Smalltalk] &lt;<a href="/user/SendEmail.jtp?type=node&node=4666537&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>&gt; a scris:</div><br class="Apple-interchange-newline"><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' type="cite">

        A member of the AST-Interpreter[1] team posted a very interesting
<br>answer on Stack Overflow.[2]
<br><br>1 - <a href="http://smalltalkhub.com/#!/~dh83/ast-interpreter" target="_top" rel="nofollow" link="external">http://smalltalkhub.com/#!/~dh83/ast-interpreter</a><br>2 - <a href="http://stackoverflow.com/questions/14520133/programmatically-get-the-execution-order-of-objects-inside-a-method" target="_top" rel="nofollow" link="external">http://stackoverflow.com/questions/14520133/programmatically-get-the-execution-order-of-objects-inside-a-method</a><br><br>Have fun! David
<br>_______________________________________________
<br>Beginners mailing list
<br>&lt;a href=&quot;x-msg://514/user/SendEmail.jtp?type=node&amp;amp;node=4665876&amp;amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;[hidden email]</a>
<br><a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_top" rel="nofollow" link="external">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br>

        
        
        
        <br>
        <br>
        <hr noshade="noshade" size="1">
        <div style="color:#444; font: 12px tahoma,geneva,helvetica,arial,sans-serif;">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                <a href="http://forum.world.st/How-do-i-list-the-execution-order-of-objects-inside-a-method-tp4665301p4665876.html" target="_top" rel="nofollow" link="external">http://forum.world.st/How-do-i-list-the-execution-order-of-objects-inside-a-method-tp4665301p4665876.html</a>
        </div>
        <div style="color:#666; font: 11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
                
                To unsubscribe from How do i list the execution order of objects inside a method?, <a href="" target="_top" rel="nofollow" link="external">click here</a>.<br>
                <a href="http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_top" link="external">NAML</a>
        </div></blockquote></div><br></div></div>

        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://forum.world.st/How-do-i-list-the-execution-order-of-objects-inside-a-method-tp4665301p4666537.html">Re: How do i list the execution order of objects inside a method?</a><br/>
Sent from the <a href="http://forum.world.st/Squeak-Beginners-f107673.html">Squeak - Beginners mailing list archive</a> at Nabble.com.<br/>