Re: WIP: default values for function parameters
От | Douglas McNaught |
---|---|
Тема | Re: WIP: default values for function parameters |
Дата | |
Msg-id | 5ded07e00812120754j5e0cdc86x7f33396394e2f080@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: WIP: default values for function parameters ("Greg Stark" <stark@enterprisedb.com>) |
Список | pgsql-hackers |
On Fri, Dec 12, 2008 at 10:31 AM, Greg Stark <stark@enterprisedb.com> wrote: > On Fri, Dec 12, 2008 at 3:11 PM, Dimitri Fontaine > <dfontaine@hi-media.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
В списке pgsql-hackers по дате отправления: