From: rocifier@... Date: 2017-09-22T10:18:37+00:00 Subject: [ruby-core:82934] [Ruby trunk Feature#13927] Integrate module_function as a core language type Issue #13927 has been updated by rocifier (Ryan O'Connor). matz (Yukihiro Matsumoto) wrote: > I admit modules with module_function play different role from ordinary modules, and so do refinements. > I am not sure how much gain we would have by making them their own objects. Adding new syntax, keywords, or concepts may make the language slightly more understandable, but may introduce incompatibility, that everyone hates. > > Matz. Hi Matz thanks for your reply. I think we would have a reasonably significant gain in making the language easier to pick up for newcomers, as well as allowing existing developers to opt-in to creating more concise and readable code. In terms of compatibility, I suppose we would need to keep backwards compatibility in a feature like this. The downside I can think of is if people need to downgrade the version of ruby they are using, which admittedly does happen from time to time. My only answer to this is that it could be an automated rubocop fix (as an example) to easily go from one syntax to the other. ---------------------------------------- Feature #13927: Integrate module_function as a core language type https://bugs.ruby-lang.org/issues/13927#change-66836 * Author: rocifier (Ryan O'Connor) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Using ruby commercially we have discovered that modules are no longer serving their original intended purpose of mixins. Another usage of the module has been shoehorned by using module_function. We have found that when developers use module_function they are converting the module into a new concept, and no longer intend their module to be used as a mixin for classes. Instead the intent of this new type of module is to provide publically accessible class methods withoutthe need for instantiation, and without polluting the global namespace. This usage is becoming potentially more common than the mixin usage. I propose that we integrate the module_function pattern as its own core ruby object along with Module and Class. -- https://bugs.ruby-lang.org/ Unsubscribe: