> On 29 Mar 2015, at 17:56, Dan Ackroyd <dan...@basereality.com> wrote: > > On 29 March 2015 at 12:28, Gints Murans <g...@gm.lv> wrote: > >> What happened to this RFC? This is a really great idea for php. > > The 'Skip Params' RFC (https://wiki.php.net/rfc/skipparams) went to > vote and was declined.
"Named params" sounds a lot better idea instead of "Skip Params". I would also vote "no" for the later one. > The 'named params' RFC (https://wiki.php.net/rfc/named_params) author > has been working on stuff they feel is more important. Sad. :( I don't know C that well to be able to help out. >> Reading over some old code, this way it would be a lot easier to understand >> what that second parameter boolean = true is: > > You can do this right now, if you want to: > > getIdByTitle('sample', $insert = true); This is fundamentally wrong, this way a local variable is created and is really not a solution for named parameters, and parameter skipping, just a workaround to fool my self. :) >> About syntax: $insert => true seems kind of confusing: >> $insert = true; >> getIdByTitle('sample', $insert => $insert) > > You shouldn't need it for the case where you're actually already using > a parameter e.g. `getIdByTitle('sample', $insert);` already indicates > what the parameter is. The only place where you could argue this > syntax is needed is when you're passing in just a bare 'true' which > has no syntactic meaning associated with it. That was only one example, how about: `getIdByTitle('sample', $insert => empty($somethingElse));`, its still confusing and for newcomers would be hard to understand, because $insert isn't a variable, but the function's parameter. Unless we look at it like we are setting function's parameters as variables, but then it shouldn't have array element assignment operator (=>). Although `getIdByTitle('sample', $insert = true);` would most probably conflict with variable assignment functionality, i.e. create local variables, which shouldn't happen in case of named parameters. Anyway my preference would be `getIdByTitle('sample', insert: true, type: 'x', description: 'Something');` > > That syntax works for all versions of PHP, so I guess a new syntax > that achieves the same thing is unlikely to be that popular an idea. Well thanks for pointing it out, but this is really a good feature and I hope i will be accepted sooner than later. > > cheers > Dan -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php