Re: Calling PL functions with named parameters

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Calling PL functions with named parameters
Дата
Msg-id 411DFBE1.7060007@opencloud.com
обсуждение исходный текст
Ответ на Re: Calling PL functions with named parameters  (Gaetano Mendola <mendola@bigfoot.com>)
Список 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 по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Calling PL functions with named parameters
Следующее
От: Oliver Jowett
Дата:
Сообщение: Re: Calling PL functions with named parameters