Is a "pure" platform needed?

bascule's Avatar

bascule

24 Aug, 2010 08:50 PM

Context for the problem is here:

http://github.com/defunkt/resque/commit/28e3f03d6536fb70254668e7e05...

Resque used to be broken on JRuby because the json gem used to only work on MRI. After a lot of complaining Charlie from the JRuby team got commit access, and patches from Evan of Rubinius got accepted. Now everything is dandy, except on IronRuby. The JSON gem only works on MRI, YARV, JRuby, and Rubinius, NOT on IronRuby.

But IronRuby isn't the only concern. What about MagLev? Or BlueRuby? There are a lot of alternative Ruby implementations out there which don't provide the MRI C extension API. Using a gem like "json" on these platforms is broken-by-default, since the "default" platform is called "ruby", and the "ruby" platform seems to assume out-of-the-gate that you can install C extensions, when in fact the opposite is true. Support for MRI C extensions is almost a rarity when it comes to the totality of Ruby implementations available, with the only implementations supporting them are MRI, YARV, Rubinius, and JRuby to a limited extent.

For these platforms, there's the "json_pure" gem. This gem exposes (in theory!) the same API as the json gem, but is implemented in pure Ruby. However, when trying to specify dependencies, which gem does one pick? json_pure is the least common denominator, but as has been seen in practice in Resque, compatibility issues can arise:

http://librelist.com/browser//resque/2010/8/13/issue-with-json-pure...

My immediate proposed solution for the resque/json scenario is:

MRI/YARV/Rubinius: use the C extension
JRuby: use the Java version
IronRuby: package json_pure as "json"
Other platforms: you're screwed

The question is, how can we solve this problem for not only IronRuby, but all other Ruby platforms without C extension support? (e.g. BlueRuby, MagLev). I would propose Ruby implementers add some check to their implementation RubyGems can use to determine if MRI-style C extensions are supported, and if they are not supported for this platform, the "pure" implementation be used in lieu of the "ruby" implementation.

Thoughts?

  1. Support Staff 1 Posted by Nick Quaranto on 31 Aug, 2010 02:37 AM

    Nick Quaranto's Avatar

    This is more of a support forum than that of discussion. Could you post this to rubygems-developers?

    http://rubyforge.org/mailman/listinfo/rubygems-developers

  2. 2 Posted by bascule on 09 Sep, 2010 05:16 PM

    bascule's Avatar

    So I posted to rubygems-developers about this (pretty much verbatim) but it said the list was moderated and my post was pending approval. It's still not been approved.

  3. Support Staff 3 Posted by Nick Quaranto on 12 Sep, 2010 11:47 PM

    Nick Quaranto's Avatar

    I think it went through :)

  4. Nick Quaranto closed this discussion on 12 Sep, 2010 11:47 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

30 Oct, 2014 04:34 PM
30 Oct, 2014 02:46 PM
28 Oct, 2014 09:51 AM
23 Oct, 2014 05:37 PM
21 Oct, 2014 10:47 AM