3 ms·
Well it depends on a runtime/compile-time distinction. A nominal type is a structural type with a compile-time constraint. If you have compile-time only consta
by mjburgess 4y ago
Well it depends on a runtime/compile-time distinction. A nominal type is a structural type with a compile-time constraint.
If you have compile-time only constants you can model nominals with structural,
type Square
static const IsSquare = true
var length = 10
You can kinda hack-in subtyping,
type Shape
static const Shape = true
type Square
import static from Shape
static const IsSquare = true
var length = 10
- gpderetta 4y agoThis is routinely done in c++ with tags (for example iterator_tag). Tags inheritance is also a thing.