Archived

This forum has been archived. Please start a new discussion on GitHub.

Ruby ICE binding

This is a continuation of a previous subthread. Progress thus far:
jrimmer:
With the newfound popularity of Ruby, especially in combination with the Rails framework, ICE support would be wonderful. Having to use webservices to access back end functionality is distressing.

marc:
I looked at Ruby some time ago, and liked it very much. However, at this time it didn't have native threads, which made it unusable for Ice. Does Ruby have native thread support now?

jrimmer:
Nope, Ruby's still missing native threads. As I'm interested in using Ruby as a caller and a native implementation won't be forthcoming how should I pursue integration? Wrap highlevel native C++ with a Ruby interface? Do you have a link for information on how to integrate non-supported runtime envrinments?

Ruby v2, which will start trickling out later this year apparently contains support for native threading. Though as Ruby's an open source codebase who knows when it will be released or precisely what features it will contain.

marc:
If you only need client-side functionality, you could wrap C++ proxies in Ruby. For server-side integration, I'm afraid you are out of luck, as the C++ runtime will dispatch requests in native threads.

You could look at the Ice for PHP source code for examples. Ice for PHP also has only client-side integration.

(If you have further questions regarding this subject, please start a new thread. This thread is for a general discussion about new Ice features.)
My interest in Ruby (at this time) is purely client-side. If the PHP ICE implementation functions in a single-threaded client mode can the same style of integration be done for Ruby? If so, it this something that a mortal could accomplish or am I better off writing C++ proxies?

Comments

  • mes
    mes California
    Hi,

    The Ice for PHP extension is implemented using Ice for C++. It wasn't too difficult with PHP, but I don't know how easy it is to extend Ruby with C++. If Ruby is implemented in C or C++, then I'd say you've got a good chance for success.

    PHP's C API is pretty scary, so you might be more confused than educated when looking at the Ice for PHP implementation. The Python extension was much more straightforward.

    If you really want to tackle this, I recommend that you design the Slice-to-Ruby mapping first. Then decide whether you want to use static or dynamic translation (i.e., whether you want a slice2ruby translator, or whether your Ruby code would load Slice definitions and have them translated dynamically). Next I would suggest getting very familiar with the Dynamic Ice chapter in the manual.

    Let us know if you have more questions.

    Take care,
    - Mark
  • Ruby's written in C but your comment about the PHP integration code being 'scary' is what I was worried about.

    Any chance of ZeroC taking on a Ruby client or are you interested in a customer funding it?
  • marc
    marc Florida
    jrimmer wrote:
    Ruby's written in C but your comment about the PHP integration code being 'scary' is what I was worried about.

    Any chance of ZeroC taking on a Ruby client or are you interested in a customer funding it?

    So far we did not have any commercial interest in Ice for Ruby. But of course if your company would fund the development, we will seriously consider it. Please contact us at info@zeroc.com if you would like to discuss this further.