Re: Variadic parameters vs parameter defaults

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org, "Brendan Jurd" <direvus(at)gmail(dot)com>
Subject: Re: Variadic parameters vs parameter defaults
Date: 2008-12-17 18:50:22
Message-ID: 1696.1229539822@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2008-12-17 19:19:19 Re: Variadic parameters vs parameter defaults
Previous Message Tom Lane 2008-12-17 18:40:04 Re: Variadic parameters vs parameter defaults