[squeak-dev] Full block closure return value testing/using in workspace?

LawsonEnglish LEnglish5 at cox.net
Mon Nov 28 10:58:44 UTC 2022

I was trying to test some ideas and was using the new FullBlockClosure to return values for further use in a workspace.

This works with “print it”:

[Transcript show: 2;cr. ^2] value => 2

This does not work:

test := [Transcript show: 2;cr. ^2] value <do it>

test => nil.

nor does this:

test :=( [Transcript show: 2;cr. ^2] value) <do it>

test => nil

print it still works:

test := ([Transcript show: 2;cr. ^2] value) => 2

test => nil.

In all cases, a 2 appears in the Transcript window, so I know that *something* is happening.

I would have thought that if print-it and  do-it work, then the returned value would be put in the test variable, but that is not the case.

I can use a  workspace global variable to access the output, but that kinda makes the ^ a one-trick-pony: useful for breaking out of loops, but not giving me access to the return value.

 [test := 2. Transcript show: test;cr. ^test] value => 2

test => 2

Is this an oversight or bug or feature for workspaces, or is it working as intended?


More information about the Squeak-dev mailing list