-
-
Notifications
You must be signed in to change notification settings - Fork 0
Types And Inference
type Box[T] = { value: T }
type MaybePair[A, B] = Pair(A, B) | Missing
type Mapper[A, B] = fn(A) -> B
Status: local inference, annotations, nominal records and sums, generic aliases, tuples, function types, references, traits, and dynamic trait values are checked and interpreted.
| Family | Types |
|---|---|
| Signed integers |
Int8, Int16, Int32, Int64, Int128, Int
|
| Unsigned integers |
UInt8, UInt16, UInt32, UInt64, UInt128, UInt
|
| Other numbers |
BigInt, Float32, Float64, Float, Decimal
|
| Scalars |
Bool, Char, Str, ()
|
| Control | Never |
| Carriers |
Option[T], Result[T, E], Task[T, E]
|
| Collections |
Array[T], Map[K, V], Set[T]
|
| References |
&T, &mut T
|
Float aliases Float64. Never participates only in unreachable control-flow joins.
type Point = { x: Int, y: Int }
type Shape = Circle{ radius: Int } | Rectangle(Int, Int) | Empty
type Predicate[T] = fn(T) -> Bool
Declared records and sums are nominal. Type aliases are transparent. A named variant payload can be positional or record-shaped; the declaration chooses the construction and pattern spelling.
fn(Int, Str) -> Bool
async fn(Str) -> Result[Int, Str]
(Int, Str, Bool)
Function types preserve async capability. Calling an async function produces a cold Task whose
success and failure channels come from the declared result.
Literals, local bindings, and private synchronous declarations participate in local inference. Exported and asynchronous signatures require complete annotations. Inference does not choose lossy numeric conversions or invent failure conversions. Trait selection rejects exact normalized duplicate heads; general overlap detection is not implemented.
Unconstrained integer literals default to Int. Context can select another wired-in integer type,
and a suffix fixes the width. Public or statement-boundary variables that remain unresolved are
diagnostics.
Borrow and dereference syntax is implemented and explicit: &value, &mut value, and *reference.
The compiler checks reference shape, dereference shape, and compiler-controlled Copy eligibility.
It does not yet enforce borrow exclusivity, mutable-binding authority for forming &mut, move
state, lifetimes, or deterministic destruction. The broader ownership and native-layout model
remains a design target, not a completed safety proof.
- Modules And Imports
- Values, Bindings, And Blocks
- Types And Inference
- Records, Sums, And Tuples
- Functions Generics And Traits
- Pattern Language
- Control Flow And Patterns
- Iteration And Loops
- Failure And Propagation
- Numbers And Collections
- Sets Maps And Sequences
- Keyed Structures
- Trees And Hierarchies
- Standard Library
- Output Formatting And Testing
- Tasks And Scopes
- Compile-Time Evaluation
- Typed Macros
- References And Unsafe
- Worked Programs