Re: Calling PL functions with named parameters

Поиск
Список
Период
Сортировка
От Gaetano Mendola
Тема Re: Calling PL functions with named parameters
Дата
Msg-id 411E1858.8020903@bigfoot.com
обсуждение исходный текст
Ответ на Re: Calling PL functions with named parameters  (Oliver Jowett <oliver@opencloud.com>)
Список pgsql-hackers
Oliver Jowett wrote:
> Gaetano Mendola wrote:>>> Oliver Jowett wrote:>>>>> Gaetano Mendola wrote:>>>>>>> Oliver Jowett wrote:>>>>>>>>> David
Fetterwrote:>>>>>>>>>>> Dennis has pointed out that mixing the call-with-named-parameter>>>>>> interface with
call-by-order-of-parametersone would cause confusion,>>>>>>>>>>>>>>>>>>>>>>>>> Python's equivalent syntax allows you to
mixthe two forms so long>>>>> as all the by-position parameters come first:>>>>>>>>> python don't have overloaded
functions...>>>>>>>>>It doesn't change how you'd handle overloaded functions; you still>>> have a type for every
parameteravailable.>>>>>>>> I think will be a mess that will break the "minor surprise" principle,>> even the bad C++
staysaway from this field ( se explicit constructors,>> and automatic cast limited to only one level ).>>> I don't
understandyour argument. What is the surprising behaviour you> are worried about?
 

I'm worried about:

(1) foo( integer, float);
(2) foo( integer, integer, float a = 3 );

which one is called with:   foo( 2, 2 )?

the first one because have two parameters or the second one
that better match the arguments ?

Whatever policy we adopt someone could argue that the (2) have
a signature with 3 parameters so the (1) shall be called, and
someone can argue that (2) is equivalent to:

(2a) foo(integer, integer)
(2b) foo(integer, integer, float);

so the (2) have to be called.


BTW C++ adopt the latter.



Regards
Gaetano Mendola
















В списке pgsql-hackers по дате отправления:

Предыдущее
От: Gaetano Mendola
Дата:
Сообщение: Re: Calling PL functions with named parameters
Следующее
От: Gaetano Mendola
Дата:
Сообщение: Re: PITR on Windows?