[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A question of type assertion
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 10 Nov 2015 08:40:56 -0200
> Come to think of it actually it could be a noop function - i.e. the
> function call would cause the code generator to insert type coercion
> operations but then the VM would recognise the noop function and do
> nothing. So I can imagine a function called cast() which is this magic
> noop function.
>
> local i: integer = cast(x[1])
>
> Would cause the code generator to emit TOINT opcode after calling the
> function cast(). But the VM would not call any function at all as it
> would recognize 'cast()' as noop.
What do you mean by "the VM" in this sentence? If the code generator can
recognize the noop funcion (so that it does not insert a call to it),
couldn't it recognize a cast function and inline it?
-- Roberto