Explicit boxing and/or tagging
Sometimes you need to do explicit boxing and/or tagging for code to work.
Let us first clarify some terminology.
What is boxing? Boxing means using a value as a reference, potentially copying it to the heap.
What is tagging? Tagging means using a value or a reference as a choice. e.g. you want to use nil as a list, where list is a choice of nil and cons cell.
The following code does not work:
we currently get a mildly confusing error:
Used abstract feature 'property.partially_orderable.type.lteq' is not implemented by 'container.ps_set.type'"
If we first box the first set via id (container.Set i32) (container.ps_set i32).empty
it works.
The reason is that infix = expects property.equatable to be implemented for the arguments.
container.ps_set however does not directly implement the needed type.equality(a,b) but inherits an implementation from container.Set.
The explicit boxing basically tells the compiler, use the ps_set like a Set from now on.