lua-users home
lua-l archive

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


On Sep 9, 2013, at 6:02 AM, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:

> Well, we do not. We could debate whether tostring{} -> 0x83ffda8 or even
> tostring("123") is CORRECT. Anyway, the manual is very clear about it:
> 
>  "Receives an argument of any type and converts it to a string in a
>  reasonable format."
> 
> The key word there is *reasonable*.
> 
> -- Roberto
> 

People will of course argue what "reasonable" means :) To my mind the real problem here, which Lua has in common with Java, C# etc, is what exactly the contract for a ".tostring()" construct could actually be? Is the string to be used for human display? As a persistence format? for debugging? No language I am aware of specifies this, with the result that in (say) Java different classes do wildly different things with tostring(). So far as I can see, emitting the current weather report would be valid according to the Java or C# docs :)

--Tim