Re: Variadic parameters vs parameter defaults

From: "Brendan Jurd" <direvus(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Variadic parameters vs parameter defaults
Date: 2008-12-17 01:18:10
Message-ID: 37ed240d0812161718o2fa816d1ya6c79932734b2c28@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 17, 2008 at 11:07 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> ISTM one could make a pretty good argument that this last case should
> succeed, producing an empty-array argument. If you buy that, then it
> is sensible to forbid defaults for variadics,

Yep, +1 for this approach. I would intuitively expect that, if I omit
variadic argument(s) when calling a function, that the function ends
up getting an empty array of the appropriate type.

And when writing a variadic function, I wouldn't find it all
surprising or annoying if I was not allowed to override this default.
In the unlikely case I want my function to do something special when
it gets an empty array, I can write that behaviour into the function
body.

Cheers,
BJ

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-12-17 01:23:49 Re: Variadic parameters vs parameter defaults
Previous Message Josh Berkus 2008-12-17 01:14:33 Re: Another issue in default-values patch: defaults expanded too soon