From: "matz (Yukihiro Matsumoto)" Date: 2013-09-15T13:14:20+09:00 Subject: [ruby-core:57201] [ruby-trunk - Feature #8912][Feedback] Exception#raise Issue #8912 has been updated by matz (Yukihiro Matsumoto). Status changed from Open to Feedback I am not sure if there's significant practical difference between raise(MyException.new(:foo,:bar)) and MyException.raise(:foo,:bar) It seems very trivial for me. I guess you hate to call the function (private method of Kernel) #raise? Can you elaborate? Matz. ---------------------------------------- Feature #8912: Exception#raise https://bugs.ruby-lang.org/issues/8912#change-41813 Author: sawa (Tsuyoshi Sawada) Status: Feedback Priority: Normal Assignee: Category: Target version: =begin When we have a custom exception class with a custom `initialize` method whose arity is not `1`: class MyException < StandardError def initialize x, y super("Something went wrong with #{x.inspect} because #{y}, blah blah") end end in order to raise it, we have to create a new instance of it explicitly using `new`, and embed that under `Kernel#raise`. raise(MyException.new(:foo, :bar)) This is inconvenient, and does not look object oriented. I propose that there should be `Exception#raise`, which is public, so that we can do: MyException.raise(:foo, :bar) A Ruby implementation may be like this: class Exception def self.raise *args; Kernel.send(:raise, *args) end end This will disallow us from calling the private method `Kernel#raise` (without an explicit receiver) within the context of an `Exception` class unless we use `send`, but I think such use case is rare, and that should not be a problem. =end -- http://bugs.ruby-lang.org/