curious behaviour - disappearing variable scope
I'm curious about the following behaviour... "In Playground, first evaluate..." s := Semaphore new. [ [ s wait. Transcript crShow: 'x' ] whileTrue ] fork. "then later..." s signal. ==> 'x' is seen in Transcript but then an error pops up "#wait was sent to nil" So... 's' *was* valid and then its not? cheers -ben
On 1 June 2018 at 14:59, Ben Coman <btc@openinworld.com> wrote:
I'm curious about the following behaviour...
"In Playground, first evaluate..." s := Semaphore new. [ [ s wait. Transcript crShow: 'x' ] whileTrue ] fork.
"then later..." s signal.
==> 'x' is seen in Transcript but then an error pops up "#wait was sent to nil"
So... 's' *was* valid and then its not?
cheers -ben
Sorry I got distracted. I should have added version info... Image ----- C:\PharoLauncher\images\Pharo-7.0.0-alpha.build.994.sha.6b52ae6.arch.32bit\Pharo-7.0.0-alpha.build.994.sha.6b52ae6.arch.32bit.image Pharo7.0alpha Build information: Pharo-7.0+alpha.build.994.sha.6b52ae62b755d8778fa0b5a4ac53b39b6c107dc9 (32 Bit) Unnamed Virtual Machine --------------- C:\Users\Ben\Documents\Pharo\vms\70-x86\Pharo.exe CoInterpreter VMMaker.oscog-eem.2361 uuid: 7ca2f89a-de70-422f-b92b-54f91ac4e47b Apr 12 2018 StackToRegisterMappingCogit VMMaker.oscog-eem.2361 uuid: 7ca2f89a-de70-422f-b92b-54f91ac4e47b Apr 12 2018 VM: 201804122226 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $ Date: Thu Apr 12 15:26:17 2018 -0700 $ CommitHash: 07c6dc3 $ Plugins: 201804122226 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $ Win32 built on Apr 12 2018 22:41:03 GMT Compiler: 6.4.0 VMMaker versionString VM: 201804122226 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $ Date: Thu Apr 12 15:26:17 2018 -0700 $ CommitHash: 07c6dc3 $ Plugins: 201804122226 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $ CoInterpreter VMMaker.oscog-eem.2361 uuid: 7ca2f89a-de70-422f-b92b-54f91ac4e47b Apr 12 2018 StackToRegisterMappingCogit VMMaker.oscog-eem.2361 uuid: 7ca2f89a-de70-422f-b92b-54f91ac4e47b Apr 12 2018 VM as selected by PharoLauncher. cheers -ben
On 1 June 2018 at 15:23, Ben Coman <btc@openinworld.com> wrote:
On 1 June 2018 at 14:59, Ben Coman <btc@openinworld.com> wrote:
I'm curious about the following behaviour...
"In Playground, first evaluate..." s := Semaphore new. [ [ s wait.
Transcript crShow: 'x'
] whileTrue
] forkAt: 41.
Apologies for my brain freeze. It should have been... s := Semaphore new. [ [ s wait. Transcript crShow: 'x'. true ] whileTrue ] forkAt: 41. But an error around the end of the block rather than the start would have been useful. cheers -ben
"then later..." s signal.
==> 'x' is seen in Transcript but then an error pops up "#wait was sent to nil"
So... 's' *was* valid and then its not?
cheers -ben
There is also #repeat for 'infinite' loops
On 1 Jun 2018, at 10:18, Ben Coman <btc@openinworld.com> wrote:
On 1 June 2018 at 15:23, Ben Coman <btc@openinworld.com> wrote:
On 1 June 2018 at 14:59, Ben Coman <btc@openinworld.com> wrote: I'm curious about the following behaviour...
"In Playground, first evaluate..." s := Semaphore new. [ [ s wait. Transcript crShow: 'x' ] whileTrue ] forkAt: 41.
Apologies for my brain freeze. It should have been... s := Semaphore new. [ [ s wait. Transcript crShow: 'x'. true ] whileTrue ] forkAt: 41.
But an error around the end of the block rather than the start would have been useful. cheers -ben
"then later..." s signal.
==> 'x' is seen in Transcript but then an error pops up "#wait was sent to nil"
So... 's' *was* valid and then its not?
cheers -ben
participants (2)
-
Ben Coman -
Sven Van Caekenberghe