From: "headius (Charles Nutter)" Date: 2012-11-25T02:03:59+09:00 Subject: [ruby-core:50044] [ruby-trunk - Feature #7299] Ruby should not completely ignore blocks. Issue #7299 has been updated by headius (Charles Nutter). Perhaps methods that want to ensure nobody accidentally passes in a block should just check for it? `fail if block_given?` for example? An option for a syntactic check in Ruby code: def foo(&nil) => raise error on call if a block is given. I don't think magic checks should be put in place for Ruby code that doesn't have an explicit block parameter. There are a lot of edge cases where the block is used and we don't know about it until later. eval/binding has been brought up, Proc.new (which should be deprecated) has been brought up, and so on. ---------------------------------------- Feature #7299: Ruby should not completely ignore blocks. https://bugs.ruby-lang.org/issues/7299#change-33819 Author: marcandre (Marc-Andre Lafortune) Status: Rejected Priority: Normal Assignee: Category: core Target version: Ruby should not completely ignore blocks. const_set :Example, Class.new do p "Hello, world" end # Doesn't print anything, generate any warning nor error. To minimize any impact, Ruby should issue a warning, and in future version could even raise an error. Even unused variables provide warnings in verbose mode, and they have their use. I can't think of a case where passing a block to a builtin method that doesn't accept a block is not a programming error though. If this is approved, I volunteer to implement this. -- http://bugs.ruby-lang.org/