Sized generics / opaque sized types =================================== Size-constrained type parameters: # interface type List8 type List16 type List32 type List64 func List8.add(T elem) func List16.add(T elem) ... # implementation func List8.add(T elem) { ... } ... Note that arithmetic operations are NOT allowed on these types! Avoiding repetition ------------------- * Manually specifying that multi-sized types and code should be created? * Implicit (internal) creation of the types/code? Implicit creation of multi-sized types/code ------------------------------------------- This would mean that for every generic type there would be 4-6 types under the hood: 8 bit, 16 bit, 32 bit, 64 bit (and maybe larger types for ref/funcref). But this can create combinatorial explosions: type Map func Map.translate(funcref (K oldkey, V oldvalue, out K2 newkey, out V2 newvalue) translator) -> Map This needs: 4^4 = 256 variants!!! This can be reduced by only generating variants with equal types for the parameters (but allow smaller types in the parameters, just not optimized to the smaller types).