lua-users home
lua-l archive

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


On Tue, Mar 4, 2014 at 8:06 AM, joao lobato <btnfdp.lobato@gmail.com> wrote:
> Perhaps "%s" should explicitly mean "invoke tostring on this".
>
> (Maybe it already does :-) )

Yes. My first observation was focusing on number's __tostring method
defaulting to "%f" instead of "%.f". My suggestion was that if this is
retained, then any planned changes to coercion should  happen at that
time, as well.

I agree that print should retain its ability to print anything. I also
think that when using "..": If the left-hand term is a string, then
the right hand term will be concatenated if it is a string or if its
"__tostring" metamethod returns a string. This seems harmless and
clear.

Otherwise, I don't think that it's a great idea to have general
coercion in either direction.I offer this opinion as someone with
almost no formal training in CSCI. It's a different perspective;
hopefully not un-useful.