Re: named function arguments (was: Proposal: Dangling comma in function call parameters)

From: Date: Fri, 24 Oct 2003 00:05:35 +0000
Subject: Re: named function arguments (was: Proposal: Dangling comma in function call parameters)
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-4949@lists.php.net to get a copy of this message
Christian Schneider wrote: [snip]
I was also thinking of proposing named parameters, i.e. basically removing the need for array() in foo(array('style' => 'hot', 'size' => 42)); but I guess that'll be even more controversial :-)
Named parameters - i think is very good idea. I know i would use them. I'm really not sure about the correct syntax for it though. They should be optional and may have default values and provide a way to extend old functions that already have optional parameters. Just for example: function f($a,$b=false,keyword $c='xyz') { } f(1) f(1,true) f(1,c='www') f(1,true,c='www') Just general thoughts: Maybe there should be a way to specify that a keyword is required. Maybe there should be a way to specify external name other than argument variable name as in the following example: function g($a,keyword 'aa' $ab) { }
Ok, that's it from my side, it's up to you now, - Chris
-- NetCat ------------------------------------------------------ SPAM-Free 10mb Free email + Antivirus + POP3 + more... Get it at http://www.doal.co.il:81/free/?c=all-spam

« previous php.internals (#4949) next »