Re: Variadic parameters vs parameter defaults

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Gregory Stark" <stark(at)enterprisedb(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, "Brendan Jurd" <direvus(at)gmail(dot)com>
Subject: Re: Variadic parameters vs parameter defaults
Date: 2008-12-17 23:15:12
Message-ID: 162867790812171515j6c477dfdqd87857bea9f25597@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2008/12/17 Gregory Stark <stark(at)enterprisedb(dot)com>:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>
>> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>>> On Wednesday 17 December 2008 20:50:22 Tom Lane wrote:
>>>> 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.
>>
>>> Maybe we'll just let it be for now and see what kind of user demands we get.
>>
>> Fair enough. We could possibly have the system install a "default
>> default" for variadic arguments, but I'd rather add that later
>> on the basis of demand than stick it in now.
>
> My inclination would be to say zero arguments is zero arguments and you get a
> zero-length array. We could eliminate the problem with anyelement by saying
> the variadic argument can't be the only polymorphic argument.
>

I disagree. Polymorphism is strong feature and without it, you have to
repeat code. Or maybe divide this problem to two cases: zero typed
variadic arguments, and nnempty polymorphic variadic argument.

Regards
Pavel Stehule

> I think there are going to be more users using non-polymorphic arguments who
> are surprised that no arguments is a special case than people using
> polymorphic arguments who are annoyed by restrictions at the intersection.
>
> Actually I think my vote would be for whatever requires the least code now. If
> you've already committed something then let's just go with that.
>
> --
> Gregory Stark
> EnterpriseDB http://www.enterprisedb.com
> Ask me about EnterpriseDB's Slony Replication support!
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-12-17 23:31:26 Re: Variadic parameters vs parameter defaults
Previous Message Simon Riggs 2008-12-17 23:14:31 Re: Preventing index scans for non-recoverable index AMs