[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: tostring(e,[base])
- From: Duncan Cross <duncan.cross@...>
- Date: Tue, 26 Jul 2011 12:27:28 +0100
On Tue, Jul 26, 2011 at 12:05 PM, Dirk Laurie <firstname.lastname@example.org> wrote:
> At present Lua has `tonumber (e [, base])` but only `tostring (e)`.
> For symmetry, `tostring (e [, base])` would be nice to have:
> Â ÂF5 = 2^32+1
> Â Âp = 641
> Â Âq = F5/p
> Â Âprint (tostring(q,2)).."â" --> 11001100011101110000001â
I disagree. It would feel odd to parameterize tostring() just for
adding a base, and not in arbitrary other extensible ways too, which I
feel would overcomplicate the function.
If anything, it shows that tonumber(e, base) should strictly be
separated out from tonumber(e) to a different function. But my
preference would be to just keep it as it is, the "asymmetry" really
doesn't seem like a problem.