Issue #8361 has been updated by alexeymuranov (Alexey Muranov).


=begin
I agree, it is getting complicated, maybe it was a bad idea.  It may be closed if you do not think it is worth consideration.

The best i could think of was to allow to use some symbol, the colon for example, to separate explicitly the block from the list of argument:

  p = lambda : [x] {
    # ...
  }

  collection.each : [element] do
    # ...
  end

But it is getting complicated and not very readable.
=end

----------------------------------------
Feature #8361: Alternative syntax for block parameter
https://bugs.ruby-lang.org/issues/8361#change-39110

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


=begin
I propose an alternative syntax for block parameters:

  p = lambda [x] {
    # do whatever you like with x here, but be sure to return the result
  }

instead of

  p = lambda { |x|
    # ...
  }

This would be consistent with the syntax of procedure call: (({p[a]})).

Also, compare:

  a_bunch.each [element] do
    # ...
  end

with:

  a_bunch.each do |element|
    # ...
  end

=end



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