Re: [RFC] Skipping parameters take 2

From: Date: Mon, 02 Sep 2013 17:23:48 +0000
Subject: Re: [RFC] Skipping parameters take 2
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-68855@lists.php.net to get a copy of this message
2013/9/2 jbondc@openmv.com <jbondc@openmv.com> > On Mon Sep 2 08:52 AM, Sebastian Krebs wrote: > > 2013/9/2 Pierre Joye <pierre.php@gmail.com> > > > > > > > > > > Any comments or feedback on the RFCs and the code are welcome, > > > > especially pointing out the cases where it may not work (which means > > > > we need more phpt's there :) > > > > > > Using default instead of ,,, is indeed much more readable. > > > > > > However I still wonder what prevents to finally implement named > > > parameters too, it will provide the same feature while being even more > > > handy and easier. > > > > > > And it covers an additional use-case: Self-explaning parameters like in > > "foo(is_strict = false)" instead of "foo(null, null, false)". > > > > > > Lots of overlap between variadic functions, this proposal & named > parameters. > > I don't think that variadic functions prevent any of the other two, or that they are used for the same cases. > interface foo { > function formatUseCases(...$options); > } > - Advantage: No dependency on a class / object > - Disadvantage: doesn't document what options are available, no default > parameters > This is totally not a use case for variadic functions. The arguments of a variadic function are indexed, not named. In addition, they have the same type (or at least they are treated the same way). Lazare INEPOLOGLOU Ingénieur Logiciel

« previous php.internals (#68855) next »