Jim Nasby <Jim.Nasby@BlueTreble.com> writes:
> One could theoretically construct a custom "type" that followed more
> traditional semantics, but then you'd lose all the syntax... which I
> suspect would make any such "type" all but unusable. The other problem
> would be having it deal with any other data type, but at least there's
> ways you can work around that for the most part.
Yeah. We've speculated a bit about allowing other datatypes to have
access to the subscript syntax, which could be modeled as allowing
'a[b]' to be an overloadable operator. That seems possibly doable if
someone wanted to put time into it. However, that still leaves a
heck of a lot of functionality on the table, such as automatic creation of
array types corresponding to new scalar types, not to mention the parser's
understanding of "anyarray" vs "anyelement" polymorphism. I have no idea
how we might make those things extensible.
regards, tom lane