[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: A question on the definition of a chunk
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 27 Jun 2012 17:56:30 +0200
> The scope of a local variable is the part of the smallest chunk
> containing its declaration which follows it.
The manual does not bring chunks into the definition of scope.
The scope of variables begins at the first statement
after their declaration and lasts until the end of
the innermost block that includes the declaration.
Is the quoted definition equivalent to that? Hardly.
The "smallest chunk containing its declaration" of a variable
is just the declaration. The part of it that follows the
declaration is empty. It's useless, but it is a chunk.
An example, showing that those are chunks.
f=load"local y=x"; print(f)
In both cases, f is a perfectly respectable function,
the execution which returns nothing and has no side effects.