lua-users home
lua-l archive

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


Hi Sean,

>   So if I understand the proposal, it's an indication to the Lua parser that
> if it understands an expression, it should optimize it?  For example, if
> this had been in Lua 5.2, and I wrote:
>
>         x = `(bit32.band(a,b))
>
> then in theory, if an extension to Lua added the '&' operator, then it could
> be rewritten (by the parser) as:
>
>         x = a & b
>
>   Am I close here?

Correct. Even better, it could rewrite it to x = a <noncharacter token
meaning &> b, and there would be a way to avoid collisions.

>   Or is it a way to prevent side effects from potential monkey patching?

No. Like I mentioned, the parser should have some way to specifically
opt into this. If you e.g. patch 'type' to return "table" instead of
"userdata", or if the code itself does this and can get away with it,
all bets are off, so this is for trusted code and/or environments
only.

Best regards,

-- 
DoubleF