Re: Named arguments in function calls

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Named arguments in function calls
Дата
Msg-id 87n08bvcl1.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: Named arguments in function calls  (Dennis Bjorklund <db@zigo.dhs.org>)
Ответы Re: Named arguments in function calls  (Neil Conway <neilc@samurai.com>)
Re: Named arguments in function calls  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Named arguments in function calls  (Dennis Bjorklund <db@zigo.dhs.org>)
Список pgsql-hackers
Dennis Bjorklund <db@zigo.dhs.org> writes:

> On 25 Jan 2004, Greg Stark wrote:
> 
> > > >  foo (x => 13, y => 42)
> > > > 
> > 
> > Is it really necessary to steal it?
> 
> Yes, it is necessary since the arguments to a function are just 
> expressions. If you do not the above would be ambigious and there is no 
> clean way to fix that. 

Of course it's ambiguous. Just as f(a,b) is ambiguous in C. It could mean call
f with two arguments, or it could mean call f with the result of the
expression "a,b". It's "fixed" by just declaring "," special inside function
calls. If you want to use the operator in the function call you have to use an
extra set of parentheses.

I'm sure that's a bit harder when you want => to be a regular identifier
outside of a function call. And the dual meaning of => is a pretty big wart,
But the compatibility with Oracle would be awfully nice. Named parameters are
going to be pretty ubiquitous once they're supported.

-- 
greg



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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: Named arguments in function calls
Следующее
От: Neil Conway
Дата:
Сообщение: Re: Named arguments in function calls