I read now http://www.perlmonks.org/?node_id=861966 But I have a question about internals
What is cause that prototype sub atan2($$); not cause the parser to grab only two arguments:
@a = (atan2 1, 2, 3);
does not become
@a = (atan2(1, 2), 3);
What is a cause to not allow perl to do that?
Best How To :
Reading documentation more accuracy. I have found this: "a list operator tends to gobble up all the arguments that follow it" and only after gobbling parser checks count of that arguments to much prototype. It seems the prototyping is like to constraint a number of arguments a function can take.
So we do not allow parser to grab two, three, four argument because this will break main rule:
- "a list operator tends to gobble up all the arguments that follow it"
If we break that rule, it will confuse reader. What does this mean:
say atan2 1, 2, 3, 4;
thus force programmer to read source code.
What about unary?
DOC: unary operators are treated as functions with one argument.
They are exception because of unary functions are simple and easily noticeable. It is hard to think wrong when you see unary. So it is OK, to grab one argument, but allowing grab two, three etc arguments make source ambiguous