[#61822] Plan Developers Meeting Japan April 2014 — Zachary Scott <e@...>

I would like to request developers meeting around April 17 or 18 in this month.

14 messages 2014/04/03
[#61825] Re: Plan Developers Meeting Japan April 2014 — Urabe Shyouhei <shyouhei@...> 2014/04/03

It's good if we have a meeting then.

[#61826] Re: Plan Developers Meeting Japan April 2014 — Zachary Scott <e@...> 2014/04/03

Regarding openssl issues, I’ve discussed possible meeting time with Martin last month and he seemed positive.

[#61833] Re: Plan Developers Meeting Japan April 2014 — Martin Bo煬et <martin.bosslet@...> 2014/04/03

Hi,

[ruby-core:62136] [ruby-trunk - Feature #9704] Refinements as files instead of modules

From: transfire@...
Date: 2014-04-22 15:57:10 UTC
List: ruby-core #62136
Issue #9704 has been updated by Thomas Sawyer.


I realized there is a downside to this approach.

~~~
# a.rb
require 'b'
class String
  def ab
    self + "a" + b
  end
end

# b.rb
class String
  def b
    self + "b"
  end
end
~~~

So what would happen with `b.rb` when `using 'a'`? Should the `require 'b'` become a `using`? If so, then what happens when it requires something that is not an extension, e.g. `set`? 

If that is an unsolvable issue. The only fix, it seems, would be a way to have something like `require_or_using` which would act according to the initial loading method used. And that starts to look pretty ugly.





----------------------------------------
Feature #9704: Refinements as files instead of modules
https://bugs.ruby-lang.org/issues/9704#change-46293

* Author: Thomas Sawyer
* Status: Open
* Priority: Normal
* Assignee: 
* Category: core
* Target version: Next Major
----------------------------------------
If refinements are to remain file-scoped, then it would be more convenient if `using` worked at the file level, akin to `require`, rather than behave like a module `include`. For instance, instead of:

~~~
# foo.rb
module Foo
  refine String do
    def some_method
      ...
    end
  end
end
~~~

~~~
require 'foo'
using Foo
~~~

We could do:

~~~
# foo.rb
class String
  def some_method
    ...
  end
end
~~~

~~~
using 'foo'
~~~

This would make `require` and `using`, in a certain sense, *polymorphic* --if we `require` it will extend the classes directly, but if `using` then they will be refined instead.




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

In This Thread

Prev Next