[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: A question on the definition of a chunk
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 27 Jun 2012 15:49:05 -0300
> OK, the concept for which I had been wrongly using these words is one
> for which I am ignorant of the right terminology. I think I mean a
> subblock that is maximal with the property that were an
> enclosing block to be preceded by a local declaration the local
> variable would be in scope in the whole subblock.
> So for example in
> do x = a(); y = b() end
> the subblocks x = a() and y = b() are not maximal, even though
> they are in the scope of foo in
> do local foo = 57; x = a(); y = b() end
> On the other hand x = a(); y = b() is maximal.
> Is this making any sense?
I do not think so. It is the same problem: blocks are lists of
statements, but that does not mean that any list of statements is a
block. If you draw the syntax tree of the above piece of code, it
becomes clear that "x = a()" (in that particular place) is not a
block. So, that occurence of "x = a()" cannot be a subblock.