[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Is string always same as number? (the consistency of lua)
- From: Miles Bader <miles@...>
- Date: Thu, 10 Feb 2011 14:54:56 +0900
Xavier Wang <firstname.lastname@example.org> writes:
> but, what is number and string?
Think of it this way:
Number and string are separate types in Lua, but in certain contexts
(e.g. arithmetic) it will automatically convert the operands from one
type to the other as required.
> maybe we can make all number-like string table index all number, is that
> more consistency?
My impression is that the generally preferred solution would be to just
remove all automatic conversions.
I don't think anybody actually thinks the automatic conversion is a
good idea these days, but it's there for historical reasons.
A zen-buddhist walked into a pizza shop and
said, "Make me one with everything."