[#99115] [Ruby master Bug#17023] How to prevent String memory to be relocated in ruby-ffi — larskanis@...
Issue #17023 has been reported by larskanis (Lars Kanis).
22 messages
2020/07/10
[#99375] [Ruby master Feature#17055] Allow suppressing uninitialized instance variable and method redefined verbose mode warnings — merch-redmine@...
Issue #17055 has been reported by jeremyevans0 (Jeremy Evans).
29 messages
2020/07/28
[#101207] [Ruby master Feature#17055] Allow suppressing uninitialized instance variable and method redefined verbose mode warnings
— merch-redmine@...
2020/12/02
Issue #17055 has been updated by jeremyevans0 (Jeremy Evans).
[#101231] Re: [Ruby master Feature#17055] Allow suppressing uninitialized instance variable and method redefined verbose mode warnings
— Austin Ziegler <halostatue@...>
2020/12/03
What does this mean?
[ruby-core:99014] [Ruby master Feature#17004] Provide a way for methods to omit their return value
From:
tenderlove@...
Date:
2020-07-01 17:04:08 UTC
List:
ruby-core #99014
Issue #17004 has been updated by tenderlovemaking (Aaron Patterson).
The more I think about this, the more it concerns me. If there is some library code like this:
``` ruby
def do_something_and_return_report
something = do_something
if RubyVM.return_value_used?
create_report(something)
else
nil
end
end
```
And I am a user of the library. I want to debug my code, so maybe I do this:
`puts do_something_and_return_report`
If I remove the `puts`, then the behavior of `do_something_and_return_report` would be totally different. Even worse, I cannot use `do_something_and_return_report` in IRB because the behavior of `do_something_and_return_report` in IRB would be totally different than the behavior in a script. It would be very confusing to explain "the behavior of `do_something_and_return_report` is different because IRB used the return value, but your script did not".
This seems like a cool trick, and something that we should use internally to MRI. But I don't think it should be exposed to users. It seems like a situation where the VM and JIT should work harder to optimize code, not library authors or library consumers.
----------------------------------------
Feature #17004: Provide a way for methods to omit their return value
https://bugs.ruby-lang.org/issues/17004#change-86389
* 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: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>