Re: Named Parameters

From: Date: Wed, 07 Apr 2010 08:59:58 +0000
Subject: Re: Named Parameters
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-47819@lists.php.net to get a copy of this message
On Wed, Apr 7, 2010 at 8:27 AM, Martin Jansen <martin@divbyzero.net> wrote: > On 5.4.2010 00:45, Pierre Joye wrote: >> On Mon, Apr 5, 2010 at 12:07 AM, Stanislav Malyshev <stas@zend.com> wrote: >> >>> 3. Combining named and un-named params can get weird - i.e. foo(1,2,3) is >>> simple, foo(1, 2, bar => 3) is doable, but foo(1, 2, bar => 3, 4) would be >>> trouble, since it is not clear at all where 4 should go to. Moreover, >> >> If we introduce named argument, mixing them should not be weird. An >> argument can have both a name and a position, allowing combination of >> normal or named arguments. Python's way to do it is very nice and >> handy: >> >> >> http://diveintopython.org/power_of_introspection/optional_arguments.html > > Just to be clear about this:  Python does not allow using an unnamed > parameter after a named parameter occurred, i.e. foo(bar = 3, 2) is not > valid there. Right, the doc is clear about that and makes the whole thing less confusing.. > I would go as far as disallowing mixing of named and unnamed parameters > completely.  But that's probably just me. That would defeat the main purposes of named arguments. Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org

« previous php.internals (#47819) next »