From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, Bernd Helmle <mailings(at)oopsware(dot)de>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Issues for named/mixed function notation patch |
Date: | 2009-10-07 21:32:48 |
Message-ID: | 162867790910071432s136f03a9ud5d08008af1282bf@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2009/10/7 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
>>> Sorry, I'm having trouble understanding what you're driving at here.
>>> I think we should just not allow named notation to be combined with
>>> VARIADIC, at least for a first version of this feature, either when
>>> defining a function or when calling one. We can consider relaxing
>>> that restriction at a later date if we can agree on what the semantics
>>> should be.
>
>> This is maybe too strict. I thing, so safe version is allow variadic
>> packed parameter with VARIADIC keyword as Jeff proposes.
>
> I'm working through this patch now, and I find myself not very satisfied
> on the question of variadic versus named arguments. What the latest
> patch actually does is:
>
> * completely ignores variadic functions when trying to match
> a call having any named arguments
>
> * does not throw an error for use of the VARIADIC keyword
> in a call together with named arguments
>
> Neither of these behaviors quite seem to me to satisfy the principle of
> least astonishment, and in combination they definitely do not.
>
> It seems to me that there is not anything wrong with using named
> arguments together with VARIADIC and getting a match to a variadic
> function. VARIADIC in the argument list essentially turns off the
> special behavior of variadic functions, and after that you might as
> well allow either named or positional matching. (I guess if you
> wanted to be really strict you'd insist that the VARIADIC keyword
> be attached to the specific named argument that matches the variadic
> parameter, but I don't mind being a bit lax there.)
>
> When VARIADIC is not specified, then I think that silently ignoring
> variadic functions for a named-argument call is probably reasonable.
> This can be argued by imagining that the function's implicit array
> element parameters do not have any names (the variadic array parameter
> might have a name, but the elements generated from it do not). Since
> these must be at the right end of the effective parameter list, and we
> only allow named arguments at the right of the call list, there is no
> way for the named arguments to match non-variadic named parameters and
> still have anything matching to the variadic array elements. Therefore
> a variadic function can never match such a call and ignoring it isn't
> surprising.
It's same as my origin ideas, much better formulated. It is ok for me.
Pavel
>
> Comments?
>
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Davis | 2009-10-07 21:41:06 | Re: Issues for named/mixed function notation patch |
Previous Message | Marko Tiikkaja | 2009-10-07 21:27:47 | Re: Writeable CTEs and side effects |