Re: Euphoria's inconsistent typing
- Posted by SDPringle Nov 09, 2015
- 1868 views
What about the syntax for function type definition? Maybe something like Basic :o)
function foo () as integer return 123 end function
Combining this new kind o type definition and function return declaration could speedup interpretation code and simplify the compiler.
Is speed a problem now? C also has syntax for specifying the returned type. Any sum or product of two integers may result in an atom. Since 4.0, any bitwise operation on two integers may result in a atom. So the language would still need to check for the values being integer after each operation to really be correct after pretty much any binary operation between integers.
The type declaration on a function means you need another type check operation just before returning the value to the caller. It would not be faster but it will result code mistakes being caught before testing.
SD Pringle