From: mame@... Date: 2020-07-01T16:02:10+00:00 Subject: [ruby-core:99008] [Ruby master Feature#17004] Provide a way for methods to omit their return value Issue #17004 has been updated by mame (Yusuke Endoh). My first impression is that this is a very bad tool to change method behavior depending upon its caller context. However, my second consideration is that such a bad thing is already possible by some ways like `Kernel#caller`. So I'm neutral. If it is introduced. I'd see an explicit caution such as "DO NOT ABUSE THIS!" in its document. ---------------------------------------- Feature #17004: Provide a way for methods to omit their return value https://bugs.ruby-lang.org/issues/17004#change-86383 * Author: shyouhei (Shyouhei Urabe) * Status: Open * Priority: Normal ---------------------------------------- In ruby, it often is the case for a method's return value to not be used by its caller. Even when a method returns something meaningful, its caller is free to ignore it. Why not provide a way for a method to know if its return value is needed or not? That adds a room for methods to be optimized, by for instance skipping creation of complex return values. The following pull request implements `RubyVM.return_value_is_used?` method, which does that: https://github.com/ruby/ruby/pull/3271 -- https://bugs.ruby-lang.org/ Unsubscribe: