lua-users home
lua-l archive

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


On Wed, Jun 13, 2012 at 10:58 AM, Andrew Starks <andrew.starks@trms.com> wrote:
> Is it not the case that if coersion were to be relegated to a loaded
> module, that module could also be written in C and implemented in an
> almost identical way to how it is today?

I don't think so.   current string-number coercion is a very low-level
(mis)feature.  the proposed loadable module is done via metatables, so
it would be measurably slower no matter if it's C or Lua.

a compile-time preprocessor flag could keep or disable current
implementation, but i think it would be a profound change, as even the
C API is affected by these coercions.

if this changes, many (most?) modules would have to be rewritten.  i
think it's worth it; but making it optional might make related bugs
much harder to find, since some authors would assume only one
behaviour and fail to test both.

I'd say +1 to get rid of the coercion, but it won't be easy.

-- 
Javier