Project

General

Profile

Actions

Feature #6868

closed

Make `do` in block syntax optional when the block is the last argument of a method and is not an optional argument

Added by alexeymuranov (Alexey Muranov) over 11 years ago. Updated over 11 years ago.

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

Description

=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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0