On 12/01/14 21:07, Kevin Ingwersen wrote:
The parser would have to be taught an actual, pretty simple, condition: Perform unusual parsing between parantheses. In pseudo code, that’d be:
if(in function argument list)
if(has named parameters)
obtain, assign and pass the paraneters.
else
fall back to traditional positioned parameters.
It would also have to ignore keywords. But that means that it would have to temporarily swap T_CONSTANTS for anything that is left from the colon. OR the colon must be attached to the last character. I.e.:
copy(from: $file, to: $file); // valid.
copy(from : $file, to : $file); // may thro an error for undefined constant?
So if the parser knows when to „think different“, then I doubt that it’ll be showing off un-robustness. However, what if the closing paranthese is missing? That are things that concern me now - actual syntax errors.
I'm... sorry? I don't understand.
If foo(bar => 3); can be easily implemented, why can't foo(bar: 3); ?
--
Andrea Faulds
http://ajf.me/