lua-users home
lua-l archive

Re: [Suggestion] Not requiring commas for table entry separation

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


Joshua Jensen:
> Likewise, if:
> f = 5
>
> and you punched in the data:
> { f "xyzzy" }
>
> _I_ would have expected (as would the non-programmer) the final result
> to be:
> { 5 "xyzzy" }
>
> And that makes it even more obvious why the commas are required (as
> unfortunate as that may be for the simple data description case).
And
 {complex{1,2}}
to be
 {complex, {1,2}}
Alas, Lua is just too smart for its own good :-(.
The real problem lies in functions being first class objects, so that:
 x = f
and
 x = f (5)
are both valid. Ie, one can't tell if an argument will follow the function
or not.
Of course this power is lost on the naive user, who'd like
 {5 6}
to be interpreted as
 {5,6}
rather than
 {5(6)}
It's not an easy problem :-(.
Cheers,
Peter Hill.

AltStyle によって変換されたページ (->オリジナル) /