Issue #6222 has been updated by rosenfeld (Rodrigo Rosenfeld Rosas).


He didn't say it was useful. He just stated that the argument for allowing it in Ruby 2.0 is not valid because it would also break compatibility just like 'then'. Also, he is advicing you to suggest new syntax to 'then' in that other ticket instead of creating new ones.

By the way, it works in Ruby because the parser will read "a ++ 2" the same way as "a++2", "a + +2" or "a + + 2". Ruby allows one to specify a number with its signal like "-3" or "+5", so "+" is not the plus operator in those representations. It doesn't mean someone actually write "+2" in real code...
----------------------------------------
Feature #6222: Use ++ to connect statements
https://bugs.ruby-lang.org/issues/6222#change-25395

Author: gcao (Guoliang Cao)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: 


I propose to use ++ to connect two or multiple statements, e.g.

do_this ++ do_that ++ do_something

It is equivalent to (do_this; do_that; do_something) but more readable.

It can be used to replace below idiom

do_something and return if condition

with

do_something ++ return if condition

The current way is very error prone because do_something might return false/nil in some cases and cause problems. And new Ruby programmers might not understand the meaning behind this idiom and mimic it blindly.

I noticed someone proposed 'then' for same purpose (See http://bugs.ruby-lang.org/issues/6201) but is postponed to 3.0 because it is already a keyword. I like 'then' too but if it is not acceptable due to backward compatibility issue, then '++' is a good alternative.



-- 
http://bugs.ruby-lang.org/