Re: Calling PL functions with named parameters
От | Gaetano Mendola |
---|---|
Тема | Re: Calling PL functions with named parameters |
Дата | |
Msg-id | 411DCA5B.7080500@bigfoot.com обсуждение исходный текст |
Ответ на | Re: Calling PL functions with named parameters (Oliver Jowett <oliver@opencloud.com>) |
Ответы |
Re: Calling PL functions with named parameters
|
Список | pgsql-hackers |
Oliver Jowett wrote: > Tom Lane wrote: > >>> On a related note, it would also be nice to have default >>> parameters and some way to say to use them. >> >> >> >> That is fundamentally not ever going to happen, because it blows >> overloaded-function resolution out of the water: there is no way to >> choose whether "foo(42, 2.5)" matches foo(int, float) or >> foo(int, float, something-with-a-default). Let's try to limit our >> attention to something that might actually work. > > > 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: void foo( int a, float b ) { } void foo( int a, float b, int c=0 ) { } int main(char argc, char **argv) { foo( 42, 2.5 ); return 0; } you'll get: 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 :-) Regards Gaetano Mendola
В списке pgsql-hackers по дате отправления: