Project

General

Profile

Actions

Bug #19881

closed

Unary operators on calls without parentheses

Added by kddnewton (Kevin Newton) 8 months ago. Updated 7 months ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:114759]

Description

At the moment it appears that you can't use unary operators when you have a call without parentheses. For example:

- foo 1, 2, 3

This seems useful, particularly for methods that perform calculations.

I'm also asking because I thought this was allowed, so YARP allows it. If it's not, I need to explicitly add a syntax error for it.

Updated by mame (Yusuke Endoh) 8 months ago

My uncertain understanding is that an expression (called "arg" in parse.y) must come after the unary minus. Since foo 1, 2, 3 is not an expression but a statement (called "command" in parse.y), - foo 1, 2, 3 is not acceptable.

Actions #2

Updated by kddnewton (Kevin Newton) 7 months ago

  • Status changed from Open to Rejected
Actions

Also available in: Atom PDF

Like0
Like0Like0