<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 27, 2023 at 2:09 AM Eduardo Ochs <<a href="mailto:eduardoochs@gmail.com">eduardoochs@gmail.com</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"><div dir="ltr">Hi list,<br><br>first some context:<br><br>  I was trying to put some blocks of executable notes in something<br>  like the "Terse Guide to Squeak"... the Terse Guide is implemented<br>  as a class called TerseGuideHelp, and I was working on a modified<br>  copy of that class, that I called EdrxGuideHelp... but then I saw<br>  that the window that shows the content of a topic in a help browser<br>  treats local variables in a way that is different than the one in<br>  workspaces - if I run "a := 42" in the window with the contents of a<br>  topic I get a dialog window whose title is:<br><br>    Unknown variable: a!<br>    please correct, or cancel:<br></div></blockquote><div><br></div><div>In HelpBrowser you must declare the variables before using them.</div><div>You use vertical lines like this:<br></div><div>| a |</div><div>a := 42.</div><div>You must select both lines before selecting doIt.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br>Now a more basic question. I sort of know where the "local variables"<br>of a workspace are stored... if I start with a single workspace and I<br>run this on it,<br><br>  w := Workspace new.<br>  w buildAndOpen.<br><br>and then I run this on the second workspace,<br><br>  a := 2.<br>  b := a + 3.<br><br>and then go back to the first workspace and "print it" this,<br><br>  w bindings.<br><br>I get:<br><br> a Dictionary('a'->2 'b'->5 )<br></div></blockquote><div><br></div><div>HelpBrowser does not implement dynamic binding of variables.<br></div><div>You can right click on a Workspace window and a HelpBrowser window and inspect the model and see the differences.</div><div>Also browse class Workspace and look at access to variable 'bindings'.</div><div><br></div><div><img src="cid:ii_lemc3nb61" alt="image.png" width="488" height="331"><br><br></div><div><br></div><div>Best,</div><div>Karl<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br>My first guess was that "do it"s and "print it"s in a workspace use<br>a dictionary of bindings, but "do it"s and "print it"s in the<br>mini-workspace of a help browser do not. I tried to understand<br>"real" workspaces first, and after setting a breakpoint in<br><br>  TextEditor >> #printIt<br><br>and doing lots of single-steppings I arrived at this method,<br><br>  TextEditor >> #evaluateSelectionAndDo:<br><br>that has this:<br><br>    result := [<br>        rcvr class evaluatorClass new<br>            evaluate: self selectionAsStream<br>            in: ctxt<br>            to: rcvr<br>            environment: (model environment ifNil: [Smalltalk globals])<br>            notifying: self<br>            ifFail: [self flash. ^ nil]<br>            logged: true.<br>    ] <br>        on: OutOfScopeNotification <br>        do: [ :ex | ex resume: true].<br><br>but when that code calls this method<br><br>  Compiler >> #evaluate:in:to:environment:notifying:ifFail:logged:<br><br>the "rcvr class evaluatorClass new" is simply a "Compiler new", "self<br>selectionAsStream" is "a := 2. b := a + 3." as a stream, the ctxt and<br>the rcvr are nil, and the environment is just "Smalltalk"... where<br>does the dictionary of local bindings enter the story? Am I doing<br>something wrong in the debugger?...<br><br>  Thanks in advance!<br>    Eduardo Ochs<br>    <a href="http://angg.twu.net/eev-squeak.html" target="_blank">http://angg.twu.net/eev-squeak.html</a><br><div><br></div></div>
<br>
</blockquote></div></div>