[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A question of type assertion
- From: Dibyendu Majumdar <mobile@...>
- Date: Mon, 9 Nov 2015 23:09:01 +0000
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