Re: Calling PL functions with named parameters

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Subject: Re: Calling PL functions with named parameters
Date: 2004-08-14 13:49:12
Message-ID: 411E1858.8020903@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Oliver Jowett wrote:

> Gaetano Mendola wrote:
>
>> Oliver Jowett wrote:
>>
>>> Gaetano Mendola wrote:
>>>
>>>> Oliver Jowett wrote:
>>>>
>>>>> David Fetter wrote:
>>>>>
>>>>>> Dennis has pointed out that mixing the call-with-named-parameter
>>>>>> interface with call-by-order-of-parameters one would cause confusion,
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Python's equivalent syntax allows you to mix the two forms so long
>>>>> as all the by-position parameters come first:
>>>>>
>>>> python don't have overloaded functions...
>>>
>>>
>>> It doesn't change how you'd handle overloaded functions; you still
>>> have a type for every parameter available.
>>
>>
>>
>> I think will be a mess that will break the "minor surprise" principle,
>> even the bad C++ stays away from this field ( se explicit constructors,
>> and automatic cast limited to only one level ).
>
>
> I don't understand your argument. What is the surprising behaviour you
> are worried about?

I'm worried about:

(1) foo( integer, float);
(2) foo( integer, integer, float a = 3 );

which one is called with: foo( 2, 2 )?

the first one because have two parameters or the second one
that better match the arguments ?

Whatever policy we adopt someone could argue that the (2) have
a signature with 3 parameters so the (1) shall be called, and
someone can argue that (2) is equivalent to:

(2a) foo(integer, integer)
(2b) foo(integer, integer, float);

so the (2) have to be called.

BTW C++ adopt the latter.

Regards
Gaetano Mendola

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oliver Jowett 2004-08-14 13:58:12 Re: Calling PL functions with named parameters
Previous Message Andrew Dunstan 2004-08-14 13:32:14 Re: PITR on Windows?