Comment #93

splitting-argument must not be first argument

Added by Yusuke Endoh 279 days ago. Updated 270 days ago.

Status:Open Start:12/03/2009
Priority:Low Due date:
Assigned to:- % Done:

0%

Category:-
Target version:-
Clause:

11.2.1

Page and Line:

42:35


Description

If the operator-expression-list of an argument-in-parentheses occurs, the first operator-expression of the operator-expression-list is called the first argument.

If a splatting-argument is the first argument, whitespaces shall not occur between its * and operator-expression.

A splitting-argument seems not to occur as "the first argument" because
"the first argument" is the first operator-expression and
operator-expression does not include splitting-argument.

Also, the following program is allowed in the current implementation:

def foo(x); end
foo(* [1])

I may misunderstand the spec. What is the intention of that sentence in the
spec?

History

Updated by Yusuke Endoh 278 days ago

I understood. This sentence forbids whitespace when argument list has no
parentheses:

def foo(x); end
foo * [1]

How about:

If the operator-expression-list of an argument-in-parentheses occurs, the first operator-expression of the operator-expression-list is called the first argument. If the indexing-argument-list has only one splatting-arguments, the splatting-arguments is also called the first argument.

Updated by Shugo Maeda 270 days ago

Yusuke Endoh wrote:

I understood. This sentence forbids whitespace when argument list has no parentheses:

def foo(x); end foo * [1]

How about:

If the operator-expression-list of an argument-in-parentheses occurs, the first operator-expression of the operator-expression-list is called the first argument. If the indexing-argument-list has only one splatting-arguments, the splatting-arguments is also called the first argument.

A block-argument can also be the first argument. So, how about the following?

If the operator-expression-list of an argument-in-parentheses occurs, the first operator-expression of the operator-expression-list is called the first argument.

If an argument-in-parentheses is of the form splatting-argument (, block-argument)?, then the splatting-argument is called the first argument, and whitespaces shall not occur between its * and operator-expression.

If an argument-in-parentheses is of the form block-argument, then the splatting-argument is called the first argument, and whitespaces shall not occur between its & and operator-expression.

Also available in: Atom PDF