-
-
Notifications
You must be signed in to change notification settings - Fork 4
number
Number is an abstract type in Angle.
It encapsulates integer float (real) bignum natural rational and complex numbers
as well as primitive/internal types bool, byte (unsigned int8), unsigned int16 (previously known as ‘word’), int32, int64 (always signed), leb128 and smart pointers : int28 and int60
Number is usually the only type users should care about:
fibonacci number = if number<2 : 0 else fibonacci(number - 1) + fibonacci it - 2
They can even emit the number type if they want to let the auto-type compiler figure the signatures out
fib := if it<2 : 0 else fib(it-1) + fib it - 2
Only in specific situations, when accessing other APIs or system calls should specific types become relevant.
If developers interact with different types, the integration (casting) should be made seamless by the compiler.
Upcasting always works and downcasting may emit a warning.
int28 supports automatic upgrading to int60 in case of overflows.