lua-users home
lua-l archive

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



>
> No, it is worth converting undefined to error generating illegal.
>

You can't trap repeated keys in e.g.

-- a, b, c have been calculated by some previous code
t = {[a]=1, [b]=2, [c]=3}

cheaply.  You can only trap them cheaply when the keys
are constant, i.e. when any idiot could have noticed them
by just staring at the code for five seconds.

We're only talking about table constructors.  Nobody forces
you to use mixed table constructors.  You can make all
mixed table constructors illegal if you like, yes.  Just a
simple patch to the source (start with lparser.c) should
do it. 

Go and do it and come tell us all how much improved
your productivity has become for not having to spend all
your time debugging code that relied on undefined
behaviour.