lua-users home
lua-l archive

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



On Jun 24, 2014, at 6:35 PM, Andrew Starks <andrew.starks@trms.com> wrote:


Even distinct types has problems. Consider tables, would t[2] and t[2.0] access the same entry? If not, lots of existing Lua code is going to break. Also see the thread regarding rounding floats to integers when (e.g.) indexing a string.

I think a lot of the problem is that the current docs don’t clearly differentiate integers from integral values. The string indexing thread, imho, is really about how to handle non-integral index values rather than integer vs float arguments.

—Tim



It's the unavoidable conflation between what a value is and what it's for. Lua only has mechanisms for the former and we have to take our own measure to infer the later. 

My reality so far is that this has not come up. The way it all works right now is about as transparent as it has needed to be. But time will tell. 

-Andrew

Generally I agree, but some of the discussions about (e.g.) flagging errors when passed “non-integer” string indexes worried me. If by “non-integer” the posters really mean “non-integral” than thats fine, but I think it’s important to be precise, especially as the whole number/float/integer thing is already causing a lot of confusion.

—Tim