lua-users home
lua-l archive

coercion to strings and numbers (was: recursively traverse...)

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


Rici Lake wrote:
> Mark Hamburg wrote:
>> I have to say that the automatic coercion between strings and numbers
>> in the Lua API is one of my least favorite features. ...
>> Furthermore, it would be nice if luaL_tostring was essentially the
>> same as invoking tostring ... so that it could handle arbitrary objects.
> I agree, wholeheartedly.
Sorry for the late entry, but I just wanted to cast my vote along with
Mark and Rici.
Perhaps there are some subtle side effects I'm missing. I have enjoyed
the benefits of the coercion when I'm typing at the interpreter, but
often that amounts to simple things like:
> print('n = ' .. n)
I would not mind having to type:
> print('n = ' .. tostring(n))
Wouldn't the __concat metamethod for strings handle that, though?
Doug
-- 
Doug Rogers 03CF-7D28-E4B1-9A56 Least 4x4+Binary magic square
Innovative Concepts, Inc. 703-893-2007 (x220) www.innocon.com

AltStyle によって変換されたページ (->オリジナル) /