[ruby-core:77214] [Ruby trunk Feature#7418][Open] Kernel#used_refinements

From: shugo@...
Date: 2016-09-08 05:18:58 UTC
List: ruby-core #77214
Issue #7418 has been updated by Shugo Maeda.

Status changed from Closed to Open

> Module.used_refinements accepted.

`Module.used_modules` might be a better name, because a module can have more than one refinement:

```
module M
  refine A
  end

  refine B
  end
end

using M
p Module.used_modules #=> [M]
```


----------------------------------------
Feature #7418: Kernel#used_refinements
https://bugs.ruby-lang.org/issues/7418#change-60434

* Author: Charlie Somerville
* Status: Open
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
I'd like to propose a method that returns an array of all refinements visible from the current scope. I have documented the ordering of the return array as undefined to allow a bit of flexibility in how it is implemented across the various Ruby implementations.

One of the criticisms of refinements is that its use makes code harder to understand - especially when non-lexical refinements are being used. This method slightly improves the situation by making debugging of code using refinements easier.

I've named the method 'used_refinements' for now, but I'm open to changing that to something else.

I've already done the initial implementation which is attached as a patch. Feedback would be most appreciated.

---Files--------------------------------
used_refinements.patch (3.06 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread