[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A question on the definition of a chunk
- From: Andrew Starks <andrew.starks@...>
- Date: Wed, 27 Jun 2012 14:48:06 -0500
On Wed, Jun 27, 2012 at 2:12 PM, Gavin Wraith <gavin@wra1th.plus.com> wrote:
> In message <20120627184905.GA7463@inf.puc-rio.br> you wrote:
>
>> > 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.
>
> OK. Reduction is not symmetric :). So, for checking that I have
> it right, am I correct in saying that a local variable's scope
> consists of the statements or blocks that follow its declaration
> that also lie within the smallest block that contains its
> declaration?
>
> --
> Gavin Wraith (gavin@wra1th.plus.com)
> Home page: http://www.wra1th.plus.com/
>
I may have this wrong, but...
Is it best to view chunks as an implementation detail that is relevant
only when you are loading them? That is, Lua can be thought to
more-or-less process (compile into byte code) chunks at a time, and
that is why you might care about them, which is to say, when syntax
errors caught by the parser would show up.
Scoping considerations, such as environment levels, closures, globals,
etc., are a feature of the language which probably doesn't map
perfectly to how Lua would process chunks of code that it reads in.
Best Regards,
Andrew Starks
- References:
- Defining a property with classlib, luciano de souza
- A question on the definition of a chunk, Alexander R.
- Re: A question on the definition of a chunk, TNHarris
- Re: A question on the definition of a chunk, Gavin Wraith
- Re: A question on the definition of a chunk, Dirk Laurie
- Re: A question on the definition of a chunk, Gavin Wraith
- Re: A question on the definition of a chunk, liam mail
- Re: A question on the definition of a chunk, Roberto Ierusalimschy
- Re: A question on the definition of a chunk, Gavin Wraith
- Re: A question on the definition of a chunk, Roberto Ierusalimschy
- Re: A question on the definition of a chunk, Gavin Wraith