Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread Brian Granger
Chris, > Different style in naming.  I prefer to keep it more Rubyist.  If > create_socket is common in Python, it's perfectly good that way. I might end up going with "socket" as well depending on how others like you go on this one. I do think it is important to try to stay somewhat close to t

Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread Chris Wong
On Mar 1, 2010, at 9:29 PM, Brian Granger wrote: > Chris, > >> 2. I prefer option 2. >> >>ctxt = ZMQ::Context.new >>sock = ctxt.socket(ZMQ::PUB) > > Other than the socket being named "create_socket" this is what I am > doing with Python bindings. > Different style in naming.

Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread Brian Granger
Chris, > 2. I prefer option 2. > >        ctxt = ZMQ::Context.new >        sock = ctxt.socket(ZMQ::PUB) Other than the socket being named "create_socket" this is what I am doing with Python bindings. > This style allow chaining... especially for one-liner. > > ZMQ::Context.new(1,1).socket(ZMQ::S

Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread Chuck Remes
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::C

Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread Chris Wong
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

Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread Brian Granger
My 0.02... > ctx = new ZMQ::Context(); > sock = ctx.socket(ZMQ::PUB); > > And following on from that: > > sock.setsockopt(ZMQ::SUBSCRIBE, ""); > sock.connect("tcp://192.168.1.1:"); With the Python bindings, I have used the following approach, which closely follows the above compromise: ctx =

Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread Martin Lucina
cremes.devl...@mac.com said: > >> For the Java and Ruby cases, why not move to a factory pattern where > >> a class method instantiates and returns an object containing the > >> context and all of the other bits? > >> // Java z = ZMQ.factory(); s = z.makeSocket(ZMQ::PUB); > >> # Ruby z = ZMQ.factor

Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread Chuck Remes
On Mar 1, 2010, at 12:17 PM, Martin Sustrik wrote: > Hi Chuck, > >> For the Java and Ruby cases, why not move to a factory pattern where >> a class method instantiates and returns an object containing the >> context and all of the other bits? >> // Java z = ZMQ.factory(); s = z.makeSocket(ZMQ::P

Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread Martin Sustrik
Hi Chuck, > For the Java and Ruby cases, why not move to a factory pattern where > a class method instantiates and returns an object containing the > context and all of the other bits? > > // Java z = ZMQ.factory(); s = z.makeSocket(ZMQ::PUB); > > # Ruby z = ZMQ.factory s = z.make_socket ZMQ::PU

Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread Martin Lucina
sust...@250bpm.com said: > Right. We should decide which one is nicer: > > z = new ZMQ (); > s = z.makeSocket (ZMQ::PUB); > > z = new ZMQ::Context (); > s = new ZMQ::Socket (z, ZMQ::PUB); > > My preference is for the latter. Two reasons: > > 1. It's the current way it is. No need to change the

Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread Chuck Remes
On Mar 1, 2010, at 11:51 AM, gonzalo diethelm wrote: z = new ZMQ (); s = z.makeSocket (ZMQ::PUB); z = new ZMQ::Context (); s = new ZMQ::Socket (z, ZMQ::PUB); My preference is for the latter. Two reasons: 1. It's the current way it is. No need to cha

Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread Martin Sustrik
gonzalo diethelm wrote: >> I had forgotten 0MQ probably keeps an internal list of sockets >> associated with its context; it certainly makes sense to have all >> outstanding socket operations fail in a graceful manner. I like this >> approach. > > So we should probably have a way to close a specif

Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread gonzalo diethelm
> I had forgotten 0MQ probably keeps an internal list of sockets > associated with its context; it certainly makes sense to have all > outstanding socket operations fail in a graceful manner. I like this > approach. So we should probably have a way to close a specific socket, and a way to signal t

Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread gonzalo diethelm
> >> z = new ZMQ (); > >> s = z.makeSocket (ZMQ::PUB); > >> > >> z = new ZMQ::Context (); > >> s = new ZMQ::Socket (z, ZMQ::PUB); > >> > >> My preference is for the latter. Two reasons: > >> > >> 1. It's the current way it is. No need to change the API. > >> 2. It's more obvious what's going on. Th

Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread Martin Sustrik
gonzalo diethelm wrote: >>> A few comments. Sorry for not sending a patch; I am in Chile, where >>> we were recently hit by a major earthquake, so my access to the repo >>> is flaky at best. >> I've read about it in paper. I hope you and your family are OK! > > Yes, thank you for the concern. I am

Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread gonzalo diethelm
> > A few comments. Sorry for not sending a patch; I am in Chile, where > > we were recently hit by a major earthquake, so my access to the repo > > is flaky at best. > > I've read about it in paper. I hope you and your family are OK! Yes, thank you for the concern. I am in Santiago, where the qu

Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread Martin Sustrik
Hi Gonzalo, > A few comments. Sorry for not sending a patch; I am in Chile, where > we were recently hit by a major earthquake, so my access to the repo > is flaky at best. I've read about it in paper. I hope you and your family are OK! > Change "binging" to ""binding" in this paragraph: "As the

Re: [zeromq-dev] Language binding guidelines

2010-03-01 Thread gonzalo diethelm
> There have been a discussion about providing a set of standard > guidelines that all language bindings should follow. The obvious idea is > to maintain at least some consistency between 0MQ APIs for different > languages. > > I've started with the document, however, it would benefit from your >