Issue #13927 has been updated by rocifier (Ryan O'Connor).


phluid61 (Matthew Kerwin) wrote:
> Sounds to me like you want a new type of object which is like `Module` but can't be `include`d. If that's the case, I'd suggest a name like `Library` or `Namespace`.
> 
> I'm still not sold on the value of the proposition.  Maybe if its methods were all defined on the singleton class? E.g.:
> 
> ~~~
> library Foo
>   def bar; end
> end
> Foo.bar #=> nil
> ~~~
> 
> Perhaps that is beyond the scope of the feature.

Yes, something like this :) the value is not huge, I admit, since it is mostly bringing the benefit of readability.

----------------------------------------
Feature #13927: Integrate module_function as a core language type
https://bugs.ruby-lang.org/issues/13927#change-66921

* 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: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>