<div dir="ltr">Hi Hilaire,<div> ok, I know why this is happening then :-)</div><div> You can see the reason in the implementation of Compiler>>#evaluate: textOrStream in: aContext to: aReceiver notifying: aRequestor ifFail: failBlock logged: doLog profiled: doProfile, there is a comment there that says: "I'm not keeping the source nor the methodNode for back compatibility.</div> The SmalltalkEditor sends the message #evaluateMethod:... which already keeps the method node<br> for the debugger to show the right source code - Hernan"<br><div><br></div><div> For some reason the #evaluate:... messages do not keep the source code and that is why you see the decompiled version in the debugger. </div><div> I do not why it is like that, but when I changed the debugger many years ago to show the source code when debugging from the debugger I decided to keep that behavior.</div><div> We can do two things:</div><div>1) You can, instead of using evaluate:, do what the workspace does. Look at the method SmalltalkEditor>>#afterCompiling: aSourceCode do: aBlock for: aReceiver in: anEvaluationContext ifFail: aFailBlock</div><div>2) Change Compiler>>#evaluate:in:to:notifying:ifFail:logged:profiled: to do keep the source code. Something like this:</div><div><br></div><div>evaluate: textOrStream in: aContext to: aReceiver notifying: aRequestor ifFail: failBlock logged: doLog profiled: doProfile<br> "Compiles the sourceStream into a parse tree, then generates code into<br> a method. If aContext is not nil, the text can refer to temporaries in that<br> context (the Debugger uses this). If aRequestor is not nil, then it will receive<br> a notify:at: message before the attempt to evaluate is aborted. Finally, the <br> compiled method is invoked from here via withArgs:executeMethod:, hence<br> the system no longer creates Doit method litter on errors."<br><br> | methodNode method sourceCodeWithDoIt |<br> <br> class := (aReceiver ifNotNil: [ aReceiver ] ifNil: [ aContext ifNotNil: [ :c | c receiver ]]) class.<br> sourceCodeWithDoIt := ((WriteStream on: String new) <br> nextPutAll: Scanner doItSelector; <br> newLine; <br> nextPutAll: textOrStream readStream contents; <br> contents) readStream.<br> <br> methodNode := self compileDoIt: sourceCodeWithDoIt in: class context: aContext notifying: aRequestor ifFail: [^failBlock value].<br> method := methodNode generate.<br> method methodNode: methodNode.<br> <br> ^self evaluateMethod: method to: aReceiver logged: doLog profiled: doProfile<br></div><div><br></div><div>If we make this change all evaluations (for example, when saving from an inspector) will show the source code when debugging.</div><div><br></div><div><a class="gmail_plusreply" id="plusReplyChip-2" href="mailto:juan@cuis.st" tabindex="-1">@Juan Vuletich</a> What do you think? <br></div><div>If you ask me, I think we should 2), I do not see any reason not to see the source code when evaluating a string.</div><div><br></div><div>Cheers!</div><div>Hernan.</div><div> </div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 21, 2024 at 5:42 PM Hilaire Fernandes <<a href="mailto:hfern@free.fr">hfern@free.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div bgcolor="#FFFFFF">
<p><font size="4">The script is not executed from a Workspace.</font></p>
<p><font size="4">I execute it with Compiler evaluate: model</font></p>
<p><font size="4">For example:</font></p>
<p><font size="4">Compiler evaluate:'| f | f :=0. 1/f'</font></p>
<p><font size="4">When the debugger is raised f is replaced by temp1
<br>
</font></p>
<div>Le 21/04/2024 à 16:16, Hernán Wilkinson
a écrit :<br>
</div>
<blockquote type="cite">it
is rare... does that happen with all the scripts you run from the
workspace?
<div>The reason it does that is because it is not finding the
original source code and therefore decompiles the code. </div>
<div>You have to look for that, why it is not finding the original
source code</div>
</blockquote>
<pre cols="72">--
GNU Dr. Geo
<a href="http://gnu.org/s/dr-geo/" target="_blank">http://gnu.org/s/dr-geo/</a>
<a href="http://gnu-drgeo.blogspot.com/" target="_blank">http://gnu-drgeo.blogspot.com/</a></pre>
</div>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div style="font-size:small"><div dir="ltr"><div dir="ltr"><div style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal"><span style="font-weight:bold">Hernán Wilkinson</span><br>Agile Software Development, Teaching & Coaching</span></font></span></span></strong></span></div><div style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">Phone: +54-011</span></font></span></span></strong></span><font face="tahoma, sans-serif" size="2">-4893-2057</font></div><div style="font-size:12.8px"><strong style="font-family:tahoma,sans-serif;font-size:xx-small"><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">Twitter: @HernanWilkinson</span></font></span></span></strong></div><div style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">site: <a href="http://www.10pines.com/" style="color:rgb(17,65,112)" target="_blank">http://www.10Pines.com</a></span></font></span></span></strong></span></div><div style="font-size:12.8px"><font face="tahoma, sans-serif"><span style="border-collapse:collapse">Address: Alem 896</span></font>, Floor 6, Buenos Aires, Argentina</div></div></div></div></div></div></div></div>