Skip to content

Hybrid (native/ruby) pathname library#857

Merged
3 commits merged intojruby:masterfrom
eregon:native_pathname
Jul 6, 2013
Merged

Hybrid (native/ruby) pathname library#857
3 commits merged intojruby:masterfrom
eregon:native_pathname

Conversation

@eregon
Copy link
Member

@eregon eregon commented Jul 5, 2013

This approach is quite similar to how MRI does it.
A good part of the library is still written in Ruby and it would take a considerable effort to translate everything (plus, it might not be very worthy). I think this should be merged in a first step.

The binding @path <=> path Java field is done by setting @path in #initialize, is there a better way?

There are a couple TODOs left, to which some light on it could help me.

Updated version of lib/ruby/1.9/pathname.rb is HEAD of the ruby_1_9_3 branch (only the require line changes from pathname.so to pathname_ext (is there a better naming, possible to differentiate pathname.{rb,jar}?
Should we add back the doc there? (in MRI, it was moved to pathname.c)

About the license, is it copied and adapted rightly?

Tests ($ bin/jruby test/externals/ruby1.9/pathname/test_pathname.rb) give:

263 tests, 520 assertions, 2 failures, 1 errors, 0 skips

The error is due to IO.open not being fully 1.9-compliant.
The first failure is ENOENT not raised with File.realdirpath (I will try to fix this).
The second failure is ENOENT being raised instead of ELOOP (symlink loop).

@headius what do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a good way to bind the java field with the instance variable?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately not. Either use an instance var or a field, and generally only use the instance var if there's significant code in the wild that expects it to be there. The field will usually be faster.

@headius
Copy link
Member

headius commented Jul 6, 2013

The PR looks like a good start, and I agree we should merge it. I'll see if I can make that happen, since it's not automatically mergable with recent source tree reorg.

@ghost ghost merged commit 10d22da into jruby:master Jul 6, 2013
@headius
Copy link
Member

headius commented Jul 6, 2013

Merged! Make sure you rebase to the new layout and read BUILDING.md for changes to the dev workflow. Looking good so far!

eregon added a commit that referenced this pull request Jul 7, 2013
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants