From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: type conversion discussion |
Date: | 2000-05-17 17:31:00 |
Message-ID: | Pine.LNX.4.21.0005171921050.349-100000@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane writes:
> > Let's say you have a function foo(float8, int2) and one foo(float4, int8)
> > and you call it with (you guessed it) float4 and int2. Which do you take?
>
> A good point; I wouldn't object to returning an error if we determine
> that there are multiple equally-good possibilities. But, again, the
> sticky question is equally good according to what metric?
IMO that metric should be "existance". Anything else is bound to be
non-obvious. Surely some breadth-first or depth-first search through the
imaginary casting tree would yield reasonable results, but it's still
confusing. I don't see any good reasons why one would have such
ambiguously overloaded functions, though I'd be very interested to see
one.
In fact one might consider preventing *creation* of such setups. That's
what programming languages would do. If I'm not mistaken then what I'm
saying is that overloaded functions must form a lattice when ordered
according to the elsewhere proposed promotion hierarchy of their
arguments. That ought to be a doable thing to check for and then we could
also use lattice concepts to find the best fitting function. Gotta work
this out in detail though.
--
Peter Eisentraut Sernanders väg 10:115
peter_e(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden
From | Date | Subject | |
---|---|---|---|
Next Message | Mikheev, Vadim | 2000-05-17 17:32:43 | RE: Berkeley DB license |
Previous Message | Peter Eisentraut | 2000-05-17 17:19:29 | Re: AW: type conversion discussion |