[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: $-globals
- From: Majic <majic.one@...>
- Date: Tue, 13 Jul 2010 15:02:41 -0700
I like the idea of $ referencing _ENV, not so sure I like $variable.
:s I already keep myself up at night thinking about which way I
should access tables. table.variable or table[variable] XD
On Thu, Jul 8, 2010 at 12:45 PM, Edgar Toernig <email@example.com> wrote:
> Roberto Ierusalimschy wrote:
>> One option would be to ban assignment to globals at all inside
>> functions. Another option would be to only allow assignments to
>> global variable previously seen in that chunk.
> Another idea (though rather perlish):
> 1) A $ is allowed as the first char of an identifier.
> 2) A single $ is what is proposed as _ENV.
> 3) $name is syntactic sugar for $.name
> 4) Access to globals without using the $ is allowed until
> the parser sees the first $-identifier in a chunk.
> From that point on, access to globals without using
> the $ raises an "undefined local"-error.
> 5) Optional, not sure: Raise an "defined as local"-error
> on $name if name is a local.
> No more confusion about local/global - globals start with
> a $! .oO(Maybe call them environment vars now *g*).
> Ciao, ET.