[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: __tostring and string.format
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 6 Dec 2010 12:39:42 -0200
> >>But then we could ask the very same question about table.concat, which
> >>also doesn't use tostring...
> >Why should it?
> Because it would be convenient. Are there any reasons for tostring()
> not to be called in these 2 cases?
Robustness? Several errors (e.g., a nil value) will be silently
supressed by 'tostring'. For '%s' this is not such a problem, as usually
we see the result, so it is easy to spot bugs. In table.concat, however,
it may cause some pain for debugging.