lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Good idea!  I suggested it about 2 years ago and didn't get anywhere with
it.  Perhaps times have changed...

I believe my suggestion was to use "method" or "routine" as the new keyword;
there doesn't seem to be an entirely satisfying word available though.


> From: "Tom " <>
> Reply-To:
> Date: Fri, 15 Sep 2000 09:13:58 -0000
> To: Multiple recipients of list <>
> Subject: suggestion for backwards compatible "global"
> One approach to introduce global/local without breaking old
> code or habits might be to have two keywords for function
> declarations.  
> A function declared with the "function" keyword would
> continue to behave as it always has.
> A function declared with another keyword (say, "fun"
> or "proc") would use the new semantics, and only in
> that context would the "global" keyword be valid.
> This would also allow people who prefer the old semantics
> (say, for writing configuration files) to keep using them.
> The documentation could describe the more error-prone
> "function" as deprecated and discourage its use.
> To help with converting old code, the interpreter
> might warn about any use of the "function" keyword when
> run with a special flag.  Of course, any new keyword
> may break a small percentage of old code; for full backwards
> compatibility, another flag could turn off recognition of
> the new keyword.
> Cheers,
> Tom.