39 ms·
I would give up hope for the ability to have a short syntax for arrays (or lots of other syntactical pleasantries) if the core team would please finally impleme
by dolinsky 15y ago
I would give up hope for the ability to have a short syntax for arrays (or lots of other syntactical pleasantries) if the core team would please finally implement named arguments.
- ahi 15y agoCould you explain what you mean by this? edit: ahh, found it. Knew what it was, but not what it was called: http://en.wikipedia.org/wiki/Keyword_argument http://en.wikipedia.org/wiki/Keyword_argument Would definitely be a solution to PHP's ridiculous argument ordering inconsistencies.
- dolinsky 15y agoYeah, keyword arguments/named parameters. The most common way that we get to implement (hack) it now is by using an associative array, which then hides parameters in the implementation of the method as opposed to exposing it in the interface which helps both with reading someone elses code as well as provides for parameter initialization and type hinting (which assoc arrays remove). I agree with you about argument inconsistencies, and named parameters would help with that, but it even goes beyond that, e.g. how many times have you seen this: function foo($bar = true, $baz = 5, $qux = "change me"){ ... } foo(true,5,"this is what i wanted to change"); when all you should have to do is: foo(qux="this is what i wanted to change");