The suggestion on extconf.rb looks great.  I'd incorporate that.

IMHO, the namespace is a must, which we both agreed.  I'm open to name it ZMQ 
rather than Zmq if you prefer that.  I don't have a particular preference one 
way or the other.

In terms of API style, I think it should adhere to the basic API in the 
C/C++/Python library.  Any extra rubyism should be wrapped on top.  There are 
plenty of messaging abstraction library out there, such as EventMachine.  It's 
a lot more difficult (or rather cumbersome) to make the API ruby-ish at the C 
layer.

Thoughts?

Chris
P.S.: Surprised that there is not much more opinions on the ruby binding.

On Feb 9, 2010, at 3:16 AM, Martin Sustrik wrote:

> Chris Wong wrote:
>> The ruby binding doesn't build correctly on Mac OS X Snow Leopard. This will 
>> fix the build.  However, I haven't fixed it enough so that it'd build with 
>> the top-level Makefile.  Will spend more time on it when I have some free 
>> cycle on it.  For now, this is needs to be built manually using.
>> ruby extconf.rb --with-libzmq-lib=<directory of libzmq.a>
> 
>>> require 'mkmf'
>>> dir_config('libzmq')
>>> -have_library('libzmq')
>>> -create_makefile("ruby")
>>> +have_library('zmq')
>>> +create_makefile("librbzmq")
> 
> McClain Looney proposed following solution:
> 
> require 'mkmf'
> dir_config('libzmq')
> -have_library('libzmq')
> -create_makefile("ruby")
> +if have_library('libzmq', 'zmq_init')
> +  puts "cool, I found your zmq install..."
> +  create_makefile("zmq")
> +else
> +  raise "Couldn't find zmq library. try setting --with-zmq-dir=<path> to 
> tell me where it is."
> +end
> 
> I have no idea how Ruby plugin system works, so I cannot judge what's 
> better...
> 
>>> +    VALUE cZmq = rb_define_module ("Zmq");
>>> +    VALUE context_type = rb_define_class_under (cZmq, "Context", 
>>> rb_cObject);
> 
> Ruby API should definitely be changed to make the usage of 0MQ as intuitive 
> an easy for Ruby developers as possible. The current way of creating socket, 
> for instance, seems to miss the namespacing:
> 
> s = Socket.new(ctx, REP);
> 
> It should probably rather look like this:
> 
> s = ZMQ.Socket.new(ctx, ZMQ.REP);
> 
> However, changing API is pretty serious matter and so it should be done _once 
> only_. Thus, before getting further it would be great if there was some 
> discussion on the topic among Ruby developers to point out possible problems 
> and drawbacks.
> 
> Martin

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to