lua-users home
lua-l archive

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


On 6 March 2014 03:15, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2014-03-04 18:45 GMT+02:00 Hisham <h@hisham.hm>:
>
> Coming from such a respected member of the Lua community, these
> comments have to be taken seriously. I have therefore taken the trouble
> of patching Lua to try out the suggested feature before replying.
>
>> On 4 March 2014 13:21, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>>> 2014-03-04 16:48 GMT+02:00 Andrew Starks <andrew.starks@trms.com>:
>>>> Yes. My first observation was focusing on number's __tostring method
>>>> defaulting to "%f" instead of "%.f".
>>>
>>> Actually,  LUA_NUMBER_FMT defaults to "%.14g", hardwired. A clean
>>> solution would be to make it settable via debug.number_format(s).
>>
>> That would be a huge step back in interoperability. I could see it
>> breaking modules everywhere.
>
> Lua 5.3.0 (work1) has three possible LUA_NUMBER_FMT
> settings, depending on the floating point length, and uses
> LUA_INTEGER_FMT for integers. What does that do
> to interoperability?

People who care about module interoperability use the interpreter in
its standard configuration.

But come to think of it, it seems that interoperability is never a
priority, anyway (or at least it's always behind tweakability), so I
guess your proposal fits Lua's spirit better.

> But it could well and truly be a debug feature. Every print statement
> containing a float could carry a tag.

Now that's quite a stretch, but I've seen weirder things.

-- Hisham