Re: Variadic parameters vs parameter defaults

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Variadic parameters vs parameter defaults
Дата
Msg-id 1696.1229539822@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Variadic parameters vs parameter defaults  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: Variadic parameters vs parameter defaults  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> Another point against that: If you wanted something else besides an empty 
> array as "default", you can handle that inside the function body by just 
> looking at how many arguments were passed.  Using the default mechanism 
> provides no added functionality.

Well, the entire default mechanism provides "no additional
functionality", since you can always emulate it with a nest of functions
(or a single function that is able to accept a varying argument list and
look at how many arguments were passed; which, please note, is not
allowed in any of the existing PLs).  What we're looking for here is a
convenient notational tradeoff.  The behavior at zero arguments is
certainly a judgment call, but it seems to me that we'll wind up with
more warts and less flexibility if we try to make the system install a
default behavior for that case.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Variadic parameters vs parameter defaults
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Variadic parameters vs parameter defaults