Issue #4007 has been updated by yhara (Yutaka HARA).

Description updated
Target version changed from 2.0.0 to Next Major


----------------------------------------
Feature #4007: numeric literal syntax sugar
https://bugs.ruby-lang.org/issues/4007#change-31515

Author: neleai (Ondrej Bilka)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: Next Major


=begin
 Hello
 As I looked to C++ extension suffing numeric literals.
 My proposal is make . in method call of numeric literal optional so we can for example write
 4i instead 4.i 
 Another application is making Time manipulations more readable like
 deadline=Time.now + 2hours
 
 Here is patch
 It should be more restrictive to disallow traps like 0xadup
 Index: parse.y
 ===================================================================
 --- parse.y	(revision 29647)
 +++ parse.y	(working copy)
 @@ -3592,6 +3592,16 @@
  			$$ = method_arg(dispatch1(fcall, $1), $2);
  		    %*/
  		    }
 +		| numeric tIDENTIFIER opt_paren_args
 +		    {
 +		    /*%%%*/
 +			$$ = NEW_CALL($1, $2, $3);
 +			fixpos($$, $1);
 +		    /*%
 +			$$ = dispatch3(call, $1, ripper_id2sym('.'), $2);
 +			$$ = method_optarg($$, $3);
 +		    %*/
 +		    }
  		| primary_value '.' operation2 opt_paren_args
  		    {
  		    /*%%%*/
=end



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