Re: Calling PL functions with named parameters

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Gaetano Mendola <mendola(at)bigfoot(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Calling PL functions with named parameters
Date: 2004-08-14 11:47:45
Message-ID: 411DFBE1.7060007@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gaetano Mendola wrote:

>> C++ manages to solve this problem, although I can't remember the exact
>> mechanics (and C++ is usually not a good example to follow anyway ;)
>
> Your're wrong:
>
> try to compile this: [...]

> a.cpp:6: error: call of overloaded `foo(int, double)' is ambiguous
> a.cpp:1: error: candidates are: void foo(int, float)
> a.cpp:2: error: void foo(int, float, int)
>
> usualy C++ is not a good example as SQL is not :-)

I think you just made my point for me. C++ allows default parameters and
resolves the ambiguity by disallowing ambiguous calls when they happen.

I'm not sure why C++ doesn't disallow it at declaration time off the top
of my head -- perhaps because you'd get inconsistent behaviour if the
candidates were split across compilation units. Since we don't have that
problem in the SQL function case, we can disallow ambiguity at the time
of creating the function.

-O

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oliver Jowett 2004-08-14 11:52:42 Re: Calling PL functions with named parameters
Previous Message Peter Eisentraut 2004-08-14 11:37:04 Re: Calling PL functions with named parameters