menu
169 tokens
Functions
Functions, lambdas and captures.
Functions
1function add(left: int32, right: int32): int32 {2 left + right3}4 5const double = (value: int32) => value * 2;FunctionPointerfor raw / think function pointers without environmentdeclarations do not nest in function bodies, except
function,type, andnewtype— a nestedclass,struct,enum,interface, orextensionis a compiler errornested
typeandnewtypedeclarations may reference enclosing generics; both erase, so no instantiation identity is created
Overloading
- dispatch and coherence
- need some .. coherent model
- first-match wins
- function overloading only within same declaration scope (single struct, class, extension, ..)