Template types #31
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It should be possible to add template types. Can experiment with a homogeneous Tuple
type that operates elementwise.
The idea is it would look like
to create the type and then to use it:
which of course can just be accomplished via
So it's all about the infrastructure to make that work. The basic idea is that the template install would install a
Tuple<any>
type with the property that when it matches, say with type 'number', it installs aTuple<number>
type and invalidates everything that depends on Tuple; and the_bundle
of an op generates implementations for allTuple<XXX>
types that exist at that time (so initially just the any type). Also in those implementations, the any type is handled specially in that specific signature references are ignored, only when the template matching type is the any type.This should actually not be that bad. Definitely worth implementing, and if it works for Tuple, then Complex should be converted to a template.
the difficulty with only adding specializations of the template when they match an "any" version is suppose
Tuple<Complex>
was matched first. then there could never be aTuple<number>
because every instance would matchTuple<Complex>
. so i think unfortunately you have to add all of the instantiations, and then update them when a new type is added.template operations are useful even without template types and should be implemented first
oh or whenever you add an instantiation you add for all subtypes and all types that can be converted to it.
Done in #45 and #46.