[#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:99031] [Ruby master Feature#17004] Provide a way for methods to omit their return value
From:
bradley.schaefer@...
Date:
2020-07-02 16:13:33 UTC
List:
ruby-core #99031
Issue #17004 has been updated by soulcutter (Bradley Schaefer). jeremyevans0 (Jeremy Evans) wrote in #note-13: > ```ruby > def foo(**kw) > kw.merge(FORCE_VALUES) > bar(**kw) > end > ``` > > This code has a bug I've seen new Ruby programmers make. The bug is that `Hash#merge` returns a new hash, it doesn't modify the existing hash. This is almost certainly a bug, because there is no reason to call `Hash#merge` without using the return value. The programmer almost certainly wanted the behavior of `Hash#merge!`. Basically, `Hash#merge` is a pure function. We could add a way to mark methods as pure functions (e.g. `Module#pure_function`), and if the method is called with VM_FRAME_FLAG_DISCARDED, Ruby could warn or raise. What scares me about this is the idea of using interactive debuggers (or even plan-old puts debugging) changing the behavior of the code. You would have to be an expert (primed to think about this behavior) to recognize that simply observing a method means you can't make any assumptions about what happens when you're not observing it. Also, how would you test this behavior? ---------------------------------------- Feature #17004: Provide a way for methods to omit their return value https://bugs.ruby-lang.org/issues/17004#change-86406 * 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>