Re: WIP: default values for function parameters

Поиск
Список
Период
Сортировка
От David E. Wheeler
Тема Re: WIP: default values for function parameters
Дата
Msg-id AA468AAB-8FC6-407A-B783-12AB84B8F689@kineticode.com
обсуждение исходный текст
Ответ на Re: WIP: default values for function parameters  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Ответы Re: WIP: default values for function parameters  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Re: WIP: default values for function parameters  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Greg Stark"
Дата:
Сообщение: Re: benchmarking the query planner
Следующее
От: Tom Lane
Дата:
Сообщение: Re: benchmarking the query planner