Re: Modify language grammar to allow commas to skip defaulted parameters.

From: Date: Sat, 26 Jul 2008 20:50:24 +0000
Subject: Re: Modify language grammar to allow commas to skip defaulted parameters.
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-39358@lists.php.net to get a copy of this message
Am 22.07.2008 um 16:37 schrieb Richard Quadling:
Actually, would allowing PHP to skip defaulted parameters be a better facility to add? function foo($opt1 = Null, $opt2 = Null){} foo(,True); Hmm. Doesn't look good does it. But, useful. Having to supply the default value if you don't want to override the default is sort of counter-intuitive. Suppling nothing should equal the default value.
That would be totally brilliant, since it means that one wouldn't have to know the default value in order to skip an argument. We looked into this a couple of months ago and the info I got from the engineer that dug into the code was that it would be relatively complicated to implement in the engine (we were considering a keyword back then, sth like foo(default, true);). But if it can be done... I'm all for it. It's definitely useful. David

« previous php.internals (#39358) next »