MOSTLY EQUAL TO KOTLIN YEAH
var= mutable,val= read-only,const= immutable- no
null,Optioninstead - keyword
type(replacement fortypealiasbut superior..?) - associated type, on top of generics like T.Error
++is not expression, only statement. (but++/--is not implemented yet)- rust-like error handling, Result & Option + Try(? mark)
- immutability exists
- pure / side-effect function division exists
- types:
Int32Float64BooleanByte(=Int8) - arithmetic matches formal mathematical behavior
-7 / 4equals-2 ... 1so that remainder is always in0..<divisor. See Euclidean division. (of course, to get division + remainder, you can usedivmod, not/.)3 / 2equals1.5, not1.3 / 2and3.0 / 2.0is identical. Note thatfloor(3 / 2)is well optimized.- Set-based type definition. For example, integer can always be used as real (number)
without any distinction. (only exception is overload where
f(int)andf(real)both exists.) - Abstract algebra thingy like Ring.
Index starts from 1. (of course this is joke)
- both compile-time and runtime generics exist
- default is half compile-time, where
value classbecomes compile-time and otherclass(referential) becomes runtime - have full information about T by default even if T is referential class, like
value is T,T.Hello. - you can do like
<erased T>to force erased. and dojust use value class to force this. If you use referential class, this is needless.<inline T>to optimize around.<inline T>exists only for abi compatibility and explicitness.
- default is half compile-time, where
someDeclaration.color: Can abstract away things likesuspend,[composable]-
Can be utilized to reduce frontend burden
-
Can be included in top-down type inference;
[annotation()] object myColor fun hello(block: [myColor] () -> Unit) hello { /* <- this block has type of [myType] () -> Unit */ }
Note that most annotations are not inferred top-down, instead they are ignored.
-
ex: Hierarchy color like applier in composable
-
someDeclaration.implicitColor: like pure(colorless) / impure(color), calls in place(colorless) / not(color)