[zeromq-dev] Language binding guidelines

Chuck Remes cremes.devlist at mac.com
Tue Mar 2 04:24:21 CET 2010


On Mar 1, 2010, at 8:50 PM, Chris Wong wrote:

> Here is my $0.02 on Ruby.
> 
> 1. There is no need for the Factory pattern in Ruby. ;-)  In Ruby, the class object is the factory.  That said, I don't think the context object is the same as factory object though.  One can have multiple ZMQ::Context objects, but you can only have one Class object in Ruby.  In most other languages, Factory class is a singleton, very similar to Ruby's class object in functionality though Ruby's class object serves more than being a factory.

Yeah, we worked through that on irc. I wasn't understanding the nuances on this list but I'm clear now.

> 2. I prefer option 2.  
> 
> 	ctxt = ZMQ::Context.new
> 	sock = ctxt.socket(ZMQ::PUB)
> 
> This style allow chaining... especially for one-liner.
> 
> ZMQ::Context.new(1,1).socket(ZMQ::SUB).connect("udp://eth0:224:0.0.1:5555")... blah blah blah
> 
> I'm developing a Ruby wrapper on top of rbzmq for more convenient usage in Ruby.  When it's in a usable state, I'll post it here.
> 

Sounds excellent. Why don't you throw it up on github? You might get some help immediately.

cr




More information about the zeromq-dev mailing list