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

Comments

Projects
None yet
5 participants
@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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link

mhenrixon commented Aug 19, 2015

Any progress on this?

@lazyatom

This comment has been minimized.

Copy link

lazyatom commented Dec 18, 2015

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

This comment has been minimized.

Copy link

jirutka commented Dec 21, 2015

Another related issue: #2977.

@headius

This comment has been minimized.

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 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
You can’t perform that action at this time.