ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp> writes:
> Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp> writes:
>>> - Are there any limitations in casting to anyelement?
>>
>> It's a no-op ... probably we shouldn't even let you do it, if the
>> lack of an error leaves room for such misinterpretation as this.
>> anyelement and friends are placeholders for use in function
>> declarations, not real types that it makes sense to cast to.
> I hope anyelement could be used in cast because casts are supported by
> almost programming languages where template or generics are available.
I think what you're suggesting is that inside a polymorphic function,
anyelement would somehow be a macro for the type that the function's
current anyelement parameter(s) have. It's an interesting idea but
it's just fantasy at the moment; I don't even have an idea of how we
might implement that.
In the meantime I'm more convinced than ever that we should throw an
error for attempting such a cast. If people are imagining that it will
do something like that, we need to disillusion them.
regards, tom lane