Re: Revisiting the "Named Arguments" RFC

From: Date: Sun, 12 Jan 2014 18:58:24 +0000
Subject: Re: Revisiting the "Named Arguments" RFC
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message


On 12/01/14 17:27, Christian Stadler wrote:
Am 12.01.2014 18:07, schrieb Kevin Ingwersen:
Am So. Jan. 12 2014 18:02:39 schrieb Andrea Faulds:
On 12/01/14 09:14, Kevin Ingwersen wrote:
So therefore, I would actually suggest using colons. It does quite mimic the ObjC calling style, but it keeps the old-fashioned function style, which I honestly prefer (besides, adopting an ObjC messaging style syntax would be either ultra-hard or never accepted :D).
It also looks like C#'s named arguments.
Oh really? Good to know, I never did anything more than Hello World with C#, because I dont trust in Mono a lot on OS X ^^;
Personally as a layman I'd prefer that syntax, too. And for keywords: You could simply put them in quotes, making is similar to the object-syntax in JavaScript/ECMAScript. And even variable-handling would be out of the discussion I guess: $abc = 'class'; test(foo: "oof", bar: "rab", 'function': 'moo', $abc: 'Foobar');
What if we combined two? test(foo: "x", 'thing' => "y"); Where the : syntax is prefixed by a bare word which is the parameter name, while the => syntax is prefixed by an expression which evaluates to a string, which is the parameter name. Though that might be confusing. It would be semi-consistent with existing array syntax, and we could then also add foo: to arrays. -- Andrea Faulds http://ajf.me/

Thread (29 messages)

« previous php.internals (#71094) next »