On Fri, 17 May 2019 at 01:21, Brainstorms <wild.ideas@gmail.com> wrote:
I beg your pardon.. and thank you for being the first to draw my attention to the fact that the phrase (a common enough American colloquialism) is actually a logical fallacy. Until now, it's been strictly idiomatic to me.
And thank you for your prompt reply.
Am I safe to assume that blocks in Smalltalk, as with Lua, capture their locally-scoped variables (referred to in Lua as "non-local variables") for correct evaluation in other contexts, such as when blocks are passed as arguments and return values? I.e., cases where the local variables of a method have gone out of scope and no longer exist, yet are referenced within the block at some future time when evaluated. I expect so; I just haven't seen it described in this detail.
You mean like this... In System Browser... Object subclass: #A instanceVariableNames: '' classVariableNames: '' package: 'AA' A >> block |a| ^ [ a := (a ifNil: [ 0 ]) + 1 ] In Playground... b := A new block inspect. { b value. b value. b value . b } "==> an Array( 1 2 3 [ a := (a ifNil: [ 0 ]) + 1 ] )" cheers -ben