[zeromq-dev] Language binding guidelines

Brian Granger ellisonbg at gmail.com
Mon Mar 1 21:25:56 CET 2010

My 0.02...

> ctx = new ZMQ::Context();
> sock = ctx.socket(ZMQ::PUB);
> And following on from that:
> sock.setsockopt(ZMQ::SUBSCRIBE, "");
> sock.connect("tcp://");

With the Python bindings, I have used the following approach, which closely
follows the above compromise:

ctx = zmq.Context(1,1)
sock = ctx.create_socket(zmq.PUB)


* There is a clear distinction between the namespace "zmq" and the Context.
* You can still create a Socket by hand using Socket(ctx, zmq.PUB).
* The Context does act like a factory for sockets, but because it does
more than that, I think it is important
to call it "Context" and not merely "SocketFactory"



> Indeed. The obvious compromise would seem to be:

> Note that I'm deliberately keeping the method names as similar as possible
> to the corresponding C zmq_xxx() function, since the C API documentation
> is the master reference for any 0MQ developer. This is important, a
> developer using XYZ language binding should not have to rely on their
> binding documenting (or duplicating the documentation of) the core 0MQ
> functionality.
> -mato
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu
ellisonbg at gmail.com

More information about the zeromq-dev mailing list