lua-users home
lua-l archive

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


> On Nov 17, 2014, at 10:29 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 
> 2014-11-18 6:11 GMT+02:00 Tim Hill <drtimhill@gmail.com>:
> 
>> Now, I know what is going on, and you know what is going on.
>> But does the average scripter know?
> 
> Does the average scripter know what is going on with
> metamethods, coroutines, the call stack, upvalues etc?
> 
> Some things in Lua are hard merely because the
> underlying computer science concept is hard. The
> subtlety of hardware representation of numbers is
> not easy. If the average scripter does not understand
> twos complement, integer overflow, etc, there is no way
> that Lua can supply the deficiency, short of seamlessly
> switching to multiprecision like Python does.
> 

And your point is? In my (limited) spare time i teach people stuff like scripting. And no, almost none of them would get metamethods or coroutines. But yes, most of them grasp the basic ideas of arithmetic operators and numbers, and even the difference between integers and floats (though at a basic level). I think the point of a scripting language is to make the learning curve less steep .. sure it can still reach wild heights, but you can get a lot done when you are still a relative beginner. I’m concerned the Lua number type is getting too complicated for these early steps, which is a shame as in almost every way Lua is an excellent language with which to learn coding.

And yes, one possibility is that 64-bit integer overflow simply silently converts to floating point. And yes, I can see all sorts of issues with such an approach (not least of which is performance and the need to retry an operation). But conceptually it has some merit.

—Tim