[#113435] [Ruby master Feature#19634] Pattern matching dynamic key — "baweaver (Brandon Weaver) via ruby-core" <ruby-core@...>
Issue #19634 has been reported by baweaver (Brandon Weaver).
6 messages
2023/05/09
[#113489] [Ruby master Bug#19642] Remove vectored read/write from `io.c`. — "ioquatix (Samuel Williams) via ruby-core" <ruby-core@...>
Issue #19642 has been reported by ioquatix (Samuel Williams).
10 messages
2023/05/15
[ruby-core:113569] [Ruby master Feature#19644] Module::current to complement Module::nesting
From:
"bughit (bug hit) via ruby-core" <ruby-core@...>
Date:
2023-05-20 19:39:11 UTC
List:
ruby-core #113569
Issue #19644 has been updated by bughit (bug hit).
Description updated
Eregon (Benoit Daloze) wrote in #note-5:
> > Could be useful for debugging/logging.
>
> Those are not performance critical, so `Module::nesting[0]` is enough.
They could be if invoked frequently enough.
>
> You also don't want to provide a concrete example where it's a clear gain, OK, let's close then until there is a clear use case for it where `Module::nesting[0]` is not enough.
Module::nesting[0] has to walk and build the entire inheritance chain. This is undesirable if you just want the current module.
If you don't know the difference between `self` and `Module::nesting[0]`, you're not qualified to reject this. Reopen it.
```ruby
class Class1
def foo
puts "#{Module.nesting[0]}##{__method__}" # Class1#foo
puts "#{self.class}##{__method__}" # Class2#foo
end
end
class Class2 < Class1
def foo
super
end
end
Class2.new.foo
```
----------------------------------------
Feature #19644: Module::current to complement Module::nesting
https://bugs.ruby-lang.org/issues/19644#change-103202
* Author: bughit (bug hit)
* Status: Rejected
* Priority: Normal
----------------------------------------
Module::current == Module::nesting[0] but without needlessly walking the entire nesting hierarchy.
Could be useful for debugging/logging.
It could also be a Kernel global (like `__method__`) or a keyword (like `__FILE__`)
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- [email protected]
To unsubscribe send an email to [email protected]
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/