A deep dive on how Go generics are implemented, with monomorphisation of call sites with primitive types for performance: https://eli.thegreenplace.net/2022/faster-sorting-with-go-generics/
The Go proposals call this 'stenciling', but I've not heard that term before. AFAICT it's monomorphisation.
miniblog.
Related Posts
Displaying value information in an IDE is tricky.
For union types, it's more helpful to see the inferred type (Option<Player> versus null). For product types it's often nicer to see an example value.
For primitive types I almost always want a value (0 versus int).
Displaying value information in an IDE is tricky.
For union types, it's more helpful to see the inferred type (Option<Player> versus null). For product types it's often nicer to see an example value.
For primitive types I almost always want a value (0 versus int).
Typescript's union types are really nice for writing interpreters.
type Value = NumberValue | StringValue;
function add(array<Value> args): NumberValue { ... }
I often find that primitive functions get little checking (e.g. just returning a Value) in the host language.