lua-users home
lua-l archive

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


On Mon, Dec 20, 2010 at 05:16, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> So how about more constrained version I suggested before, i.e. leave
>> prefixexp in but extend it so that it can contain also literal
>> constant?
>>
>>  - prefixexp ::= var | functioncall | ‘(’ exp ‘)’
>> + prefixexp ::= var | functioncall | ‘(’ exp ‘)’ | String
>
> It has exactly the same problem:
>
>  a = "hellooo"
>  (print or io.write)(a)
>
> Moreover, it is too ad-hoc. We justify parentheses as the only
> exception because everything else fits inside them. But to allow
> parentheses plus strings, because that is what happens to be useful
> right now, is not a good argument.
>
> -- Roberto
>
>

I do like the idea of being able to do things like "a":byte() or {1,
2, 3}[n] without the additional parentheses we need now. Would these
expressions be possible without introducing ambiguity?

-- 
Sent from my toaster.