Darren Duncan <darren@darrenduncan.net> writes:
> But I'm just citing numeric as an example; there would be a lot more
> in practice, potentially one for every individual type, so for example
> if operators were defined for the open union rather than for the base
> type, then users/extensions could define their own types and easily
> declare "you can use it like this type" but its different in some
> important way, which may just be an implementation difference.
> Operations that don't care about the differences can just be written
> against the open union type where they just work and those that do
> care can be more specific.
I'm just an old-school abstract data type hacker, but I don't see
anything in what you're saying that doesn't work today in our existing
type system: with overloaded and/or polymorphic operators and functions
you can get all those effects. Maybe there would be some small gain in
ability to share code for tasks that fall between single-data-type and
works-for-anything cases, but it looks like a pretty marginal
improvement from here; probably not worth the cost and compatibility
implications of a major overhaul of the type system.
regards, tom lane