[squeak-dev] getting the edit Workspace from UIManager

Lauren P drurowin at gmail.com
Mon Jan 9 16:50:39 UTC 2023


Hey List,

I'm using UIManager>>edit:label:accept: to open a Text for editing and I'd
like to close the Workspace when the user accepts the text.

Is there a way to pass the Workspace to the block closure?

I tried

| ed |
ed := UIManager default
   edit: o
   label: l
   accept: [ :new |
      . . .
      ed delete]

but ed got unbound by the time the block was called.  I was kinda expecting
Smalltalk to have lexical extent for block closures, not dynamic extent.¹

I know I can use a Y-combinator to add it to a block variable², but I was
wondering if there's something way more Smalltalk and less
I-Learned-To-Program-With-Assembler.  I'm sure it's something obvious, but
there's just so much to Morphic.  It's nice to know I can, but it seems
like a bug that I would have to.

Thanks,
Lauren

1.  I was studying Context to see how it worked and saw the temp stack gets
dropped on return, but had a hard time studying its behavior with block
closures and multithreading.

2.  While I was examining the workings of the call stack I figured out how
to bind block-local variables from outside their lexical scope.  Mostly to
get a better understanding of how it worked.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20230109/bef156ac/attachment.html>


More information about the Squeak-dev mailing list