Skip to content
pannous edited this page Sep 22, 2021 · 15 revisions

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

The internal number types are mostly isolated from the user facing number type, which handles automatic casting, up and downgrading between all different kinds of numbers: integers, reals, rational and complex numbers. Developers can unknowingly accept an int8 and return a bignum pointer if their calculation grows out of hand. Unless they really want all they need is number as parameter or variable type. Or no type at all if they rely on type inference

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.

implicit multiplication

as in julia and math, a number next to an object means multiplication:

3x == 3*x

we have a problem with significant whitespace though:

3 x == [3 x]

as defined by commaless list semantics

this should be a typical case of ambiguity handled by the compiler by asking the user to specify the intent

plate numbers

Special user types such as phone number and License plate number should be of no conflict to the built-in abstract type.

this would be hard to achieve and currently the easiest workaround is to drop the number word in those cases or hyphen it

Home

Philosophy

data & code blocks

features

inventions

evaluation

keywords

iteration

tasks

examples

todo : bad ideas and open questions

⚠️ specification and progress are out of sync

Clone this wiki locally