[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Arithmetic on strings
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 13 Jun 2012 13:35:35 -0300
> On Wed, Jun 13, 2012 at 10:58 AM, Andrew Starks <firstname.lastname@example.org> 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.
I mostly agree that the change would not be that easy, but I do not think
performance would be a problem. Any performance-conscious code that uses
coercion in critical pathes deserves what it gets. (Even io.read and
io.write allow I/O without coercions.) Moreover, basic operations with
the correct types should become slightly faster, due to the simplification.