lua-users home
lua-l archive

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


On 9 November 2015 at 22:15, Coda Highland <chighland@gmail.com> wrote:
>> Now here is a hypothetical question - if Lua had been statically typed
>> language - what would the ideal expression be for this kind of type
>> coercion?
>>
> Personally I'd go with asinteger() (or perhaps cast.integer(), to
> limit the namespace pollution to a single keyword) so that the grammar
> doesn't need modified, and then special-case the function invocation
> as some kind of intrinsic instead of an actual function call.
>

According to the 'Evolution of Lua' paper the last Lua version that
had intrinsics was 3.2. I had a quick look but it seems that the
intrinsics were just predefined library functions - i.e. the VM wasn't
aware of those functions in any special way - but I could be mistaken
as I only glanced at this very quickly.

I have been thinking about the idea of intrinsics that the VM is aware
of. Agree that doing it this way means that it behaves no different
than if there were some functions that did the same thing.

Regards
Dibyendu