47 Generic types
Box<T> defines one structure whose item type depends on T. Box<Integer> and Box<String> have different checked field types; value equality still compares contents.
norm
value Box<T> {
T item
}
main() {
Box<Integer> count = Box<Integer>(item: 7)
Box<String> label = Box<String>(item: "Norm")
printLine(count.item)
printLine(label.item)
printLine(count == Box<Integer>(item: 7))
}Expected output:
text
7
Norm
trueTry it: Try assigning label.item to an Integer binding.
Precise rules: Reference.