Re: WIP: default values for function parameters

From: "Douglas McNaught" <doug(at)mcnaught(dot)org>
To: "Greg Stark" <stark(at)enterprisedb(dot)com>
Cc: "Dimitri Fontaine" <dfontaine(at)hi-media(dot)com>, "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>, "Heikki Linnakangas" <heikki(dot)linnakangas(at)enterprisedb(dot)com>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "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 15:54:18
Message-ID: 5ded07e00812120754j5e0cdc86x7f33396394e2f080@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 12, 2008 at 10:31 AM, Greg Stark <stark(at)enterprisedb(dot)com> wrote:
> On Fri, Dec 12, 2008 at 3:11 PM, Dimitri Fontaine
> <dfontaine(at)hi-media(dot)com> wrote:
>> That's why I'm preferring the common-lisp syntax of :param value, or its
>> variant param: value.
>
> FWIW there is no such common-lisp syntax. Colon is just a regular
> symbol character and :param is just a regular symbol in common-lisp.
> There is a convention that functions parse their argument lists
> looking for such tokens as indicators of what to do with the next
> argument but it's purely a convention. There's no syntactic
> significance to the colon.

Drifting off-topic and being really nit-picky, you're wrong. :) It's
more than just a "convention". Colons *are* special in symbol
names--the leading colon designates the symbol as being in the KEYWORD
package (i.e. symbol namespace; you can put symbols in other packages
by prepending a package name to the colon) and there is standard
syntax (&key) for specifying allowed keyword arguments to a function;
said keys must be symbols in the KEYWORD package.

So the proposed foo( :bar 12, :baz 'stuff' ) syntax is actually very
close to the Common Lisp syntax, though there may be very good reasons
not to use it in PG.

> A similar problem arises with using Perl as a precedent. => is just a
> regular operator in perl which quotes the lhs as a string if it's a
> simple token and otherwise behaves just like a comma. That would be
> very different from what we're talking about having it do here.

Very true, and I think the "don't break people who are using => as a
prefix operator" argument is pretty conclusive.

-Doug

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Grzegorz Jaskiewicz 2008-12-12 15:56:59 Re: Polymorphic types vs. domains
Previous Message Greg Stark 2008-12-12 15:31:46 Re: WIP: default values for function parameters