Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.1] Refinements #1062

Closed
headius opened this issue Oct 1, 2013 · 6 comments
Closed

[2.1] Refinements #1062

headius opened this issue Oct 1, 2013 · 6 comments
Assignees
Milestone

Comments

@headius
Copy link
Member

headius commented Oct 1, 2013

Refinements have been pared back to a much more reasonable form that does not have performance implications for unrefined code. They will ship as an official feature in 2.1.

We need to implement refinements in JRuby, at least as an experiment, as soon as possible to know whether they have undiscovered issues. Once they ship in 2.1 it will be much harder to fix them.

I'm marking this for 1.7.6, since I want to do the experiment ASAP.

https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/RefinementsSpec

@ghost ghost assigned headius Oct 1, 2013
@headius headius assigned enebo and unassigned headius Jan 14, 2015
@enebo
Copy link
Member

enebo commented Jan 18, 2015

I realized if I land this in its current 50%+ working state it will not work in JIT since in this form it still has a refinedcallinstr vs using a refinedcallsite. Even had I made that change the JIT would still need some work so I am deferring this until next 9k release.

@enebo
Copy link
Member

enebo commented Apr 28, 2015

At the point of pre2 we are passing a substantial portion of refinement tests but we have quite a few significant failing tests (see test/mri). So more work to do before RC

@enebo enebo modified the milestone: JRuby 9.0.0.0 Jul 14, 2015
@mhenrixon
Copy link

Any progress on this?

@lazyatom
Copy link

I've hit some strange behaviour trying to use refinements with version 9.0.4.0:

module Refinement
  refine Object do
    def new_method
      'new method!'
    end
  end
end

class Thing
  using Refinement

  p in_class_definition: Object.new.new_method

  def test
    p in_method: Object.new.new_method
  end
end

Thing.new.test

outputs

{:in_class_definition=>"new method!"}
NoMethodError: undefined method `new_method' for #<Object:0xcfa9dbf>
   test at test.rb:15
  <top> at test.rb:19

It seems like there's something amiss with the lexical scoping of the method; in MRI, methods defined with the lexical scope where a refinement is activated can make use of that refinement. Is this expected behaviour in JRuby as of 9.0.4.0?

@jirutka
Copy link

jirutka commented Dec 21, 2015

Another related issue: #2977.

@headius
Copy link
Member Author

headius commented Dec 22, 2015

I'm going to close this one because refinements are at least in place, albeit rather buggy. #3548 and #2977 track known issues.

@headius headius closed this as completed Dec 22, 2015
@headius headius added this to the JRuby 9.0.2.0 milestone Dec 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants