Re: Variadic parameters vs parameter defaults - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Variadic parameters vs parameter defaults
Date
Msg-id 1696.1229539822@sss.pgh.pa.us
Whole thread Raw
In response to Re: Variadic parameters vs parameter defaults  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Variadic parameters vs parameter defaults
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: Variadic parameters vs parameter defaults
Next
From: Peter Eisentraut
Date:
Subject: Re: Variadic parameters vs parameter defaults