lua-users home
lua-l archive

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


On Wed, Jun 13, 2012 at 8:57 AM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:

> (Probably the right thing to do would be to elliminate coersion from
> strings to numbers altogether...)
>
> -- Roberto
>

If I may be so bold as to say that I hope this change is made to the
language. I see coersion of strings to numbers as a litmus test for
languages.

I respect and understand the good reasons behind the way Lua does
this. To my thinking, the benefits of convenience and simplification
are outweighed by all of the available rope that is now lying around,
waiting for someone to figure out how they might use it....

Also, it seems that while deleting this ability would break some code,
it could be easily patched by manually overloading __add, etc. Of
course, Lua 5.3 could have a handy module or other mechanism that
might be loaded, restoring the old way by using a completely coherent
and language compatible method without requiring that I hand-implement
it.

USELESS ASIDE: It also reminds me of the decision that web browser
manufacturers made when they decided to make browsers tolerant of HTML
that was not properly formed. They were doing me/others a 'favor' by
happily "doing the best they could" with my invalid code, but it
inevitably blew up in my face when another browser barfed on it or had
another interpretation of "best". The truth is, I probably was typing
a mistake about 85% of the time and doing what I thought was write,
but in the wrong way, the other 15%.

I would inevitably find the strictest browser that I could find, only
to validate what I had done. This would always lead to cleaner HTML
and I learned more from that process.