Issue #6868 has been updated by drbrain (Eric Hodel).

Status changed from Open to Feedback
Priority changed from Low to Normal

=begin
What would this code do:

  def method n
    n = n.times
    p n
    n
  end

Currently it prints (({#<Enumerator: 3:times>})) and returns an Enumerator.  Would it instead raise SyntaxError for an unexpected end?

=end
----------------------------------------
Feature #6868: Make `do` in block syntax optional when the block is the last argument of a method and is not an optional argument
https://bugs.ruby-lang.org/issues/6868#change-28871

Author: alexeymuranov (Alexey Muranov)
Status: Feedback
Priority: Normal
Assignee: 
Category: core
Target version: 3.0


=begin
I propose to make the use of "(({do}))" in block syntax optional if the block is the last argument of a method and if it is a required argument, at least if the block does not take parameters.  (I think this would be in line with how for example the last hash argument is treated.)  I also think that this syntactic change may allow in future versions of Ruby to make (({def})), (({class})), (({module})) methods instead of keywords.

Something like:

 3.time
   puts "Hi!"
 end

instead of

 3.time do
   puts "Hi!"
 end

I know this is not a good example, because for (({#times})) the block argument is optional.
=end



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