lua-users home
lua-l archive

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



If we exclude the ability for an implicit declaration at load time, then
type coercion could happen at compilation time by selecting the appropriate
ops. Then there wouldn't be any run time cost to the expanded typing.

I'm not certain that's true.  If a chunk compiled with one precision setting gets numbers from a chunk compiled with different precision settings, there's going to be some cost whenever the passed values are type-checked and cast.  Similarly, any values you pull out of a table could potentially have been written by a chunk with different precision settings.  As best as I can imagine the two implementations, a chunk with _PRECISION set at compile time would probably need to do just as much type checking as a chunk that allowed _PRECISION to change during runtime.

Roberto seemed to think that his coercing rule could be implemented with minimal overheads -- I suspect he's right, and I also suspect that switching between a couple different precision handling rules would be possible with similarly low overheads.  Though of course if any integer subtype feature were to be added to the language, an effort should certainly be made to confirm the hunches behind it.

-Sven