RE: [PHP-DEV] [RFC] Skipping parameters take 2

From: Date: Mon, 02 Sep 2013 18:56:09 +0000
Subject: RE: [PHP-DEV] [RFC] Skipping parameters take 2
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
> 
> > 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).
> 

Right I'm for variadic '...$options' as proposed with indexed arguments (just like
c). Python calls this positional arguments.

I'm stretching the comparison to see if syntax could be augmented to serve another use case
(with named arguments)?

..$options[] would be more similar to  **keyparam in python:
http://rosettacode.org/wiki/Named_Arguments#Python



Thread (69 messages)

« previous php.internals (#68856) next »