Re: WIP: default values for function parameters

From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: "Heikki Linnakangas" <heikki(dot)linnakangas(at)enterprisedb(dot)com>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Gregory Stark" <stark(at)enterprisedb(dot)com>, "Grzegorz Jaskiewicz" <gj(at)pointblue(dot)com(dot)pl>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Subject: Re: WIP: default values for function parameters
Date: 2008-12-12 14:51:37
Message-ID: AA468AAB-8FC6-407A-B783-12AB84B8F689@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Dec 12, 2008, at 3:38 PM, Pavel Stehule wrote:

> I discussed about this form with Tom.
>
> I thing so following should be readable:
>
> name: [ optional => ] value
>
> SELECT foo( bar: 'ick', baz: 'ack' );
> SELECT foo( bar: => 'ick', baz: => 'ack' );
>
> or
>
> SELECT foo( bar: = 'ick', baz: = 'ack' );
>
> reason for optional using of "=>" is too thin char ":", so =>
> optically boost the colon.

Hrm. I can see that, I guess. In that case, though, I think I'd prefer
the colon at the beginning of the parameter label:

SELECT foo( :bar => 'ick', :baz => 'ack' );

In that case, though, I'd want the => to be required. Note that
there's a precedent here, too: This is Ruby's syntax for using
"symbols" for parameter names.

> this is 100% compatible because syntax name: is new token

Interesting. I hadn't expected that the use of the colon to make the
use of => be okay. Cool that it does, though.

Best,

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-12-12 14:54:02 Re: benchmarking the query planner
Previous Message Greg Stark 2008-12-12 14:50:41 Re: benchmarking the query planner