While you could make a method constructor(collection::T, args...)
, I’d expect ConcreteCollection(args...)
because typically a concrete subtype will implement constructor methods with the same name as the struct.
Additionally, I think constructor
’s first argument collection
only provides type information because (x * elt for elt in collection)
should provide all the data. A ConcreteCollection
method would be inherently specific to the type so it wouldn’t need the first argument at all.
This bit has nothing to do with removing the need to implement something for each concrete type, either way you would do just that.