lua-users home
lua-l archive

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


On Apr 20, 2014, at 11:35 PM, Coroutines <coroutines@gmail.com> wrote:

> On Sun, Apr 20, 2014 at 9:32 PM, Paige DePol <lual@serfnet.org> wrote:
>> I just noticed there is a discrepancy in the macro names in lobject.h for floating point numbers and thought I would mention it here.
>> 
>> The macro to access the floating value is named `fltvalue`, however, the macro to set the value is named `setnvalue`. The macro to set the integer value is named `ivalue` which matches the setter macro named `setivalue`.
>> 
>> The getter/setter macros seem to use the same letter as the variables defined in the union, however, with the new integer/float number types I can see why the integer macro would be changed; to prevent confusion with previous Lua versions.
>> 
>> Instead of `flt`, however, why not use `r` for "real"? This would then give us `rvalue` and `setrvalue` for the macros. I suppose the variable in the union could also be changed to `r` from `n` for consistency, though not really necessary.
>> 
>> In any case, either `fltvalue` or `setnvalue` should be changed so both macros are using the same naming convention. :)
>> 
>> ~pmd~
> 
> I haven't looked at the code so don't take my opinion too seriously,
> but "rvalue" could have other confusing connotations.  setfvalue()
> would not be more obvious?

`fvalue` and `setfvalue` are already in use for light c functions, which is why I suggested `r` for "real".

What confusing connotation are you referring to, by the way?

~pmd~