Re: Calling PL functions with named parameters - Mailing list pgsql-hackers

From Oliver Jowett
Subject Re: Calling PL functions with named parameters
Date
Msg-id 411DFBE1.7060007@opencloud.com
Whole thread Raw
In response to Re: Calling PL functions with named parameters  (Gaetano Mendola <mendola@bigfoot.com>)
List 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


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Calling PL functions with named parameters
Next
From: Oliver Jowett
Date:
Subject: Re: Calling PL functions with named parameters