[zeromq-dev] Language binding guidelines

gonzalo diethelm gdiethelm at dcv.cl
Mon Mar 1 16:08:04 CET 2010

> 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
> comments and observations:
> http://www.zeromq.org/guidelines:bindings

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.

Change "binging" to ""binding" in this paragraph:
"As these constants are the main extensibility mechanism for ØMQ, developer of the binging should make it as easy as possible to add new constants to the set."

On OO languages, I think Brian's idea about putting everything inside the global ZMQ class makes sense. If we carry this idea to the extreme, it would mean that the Context object might very well be invisible to the user:

class ZMQ {
  private Context context;

  public ZMQ() {...}

  public Socket makeSocket(...) { /* use context here */ }

You might have several of these ZMQ objects initialized at the same time (each hiding a Context object). The nice thing about this approach is that the user only deals with Socket objects (through the ZMQ class).

Question: Java does not have proper destructors; there are no assurances as to when an object that is not used anymore will be chosen for destruction. This means there is no way to explicitly invoke the corresponding calls to zmq_term() (for Context) and zmq_close() (for Socket). If this might be a problem, perhaps we should expose these calls through an explicit destroy() / close() method in the binding. What do you think? What is the case in other languages? This is sort of covered in the proposed policy, but it is not explicitly mentioned in the context of languages lacking destructors.

Gonzalo Diethelm

Declaración de confidencialidad: Este Mensaje esta destinado para
el uso de la o las personas o entidades a quien ha sido dirigido y
puede contener información reservada y confidencial que no puede
ser divulgada, difundida, ni aprovechada en forma alguna. El uso no
autorizado de la información contenida en este correo podrá ser
sancionado de conformidad con la ley chilena. 
Si usted ha recibido este correo electrónico por error, le pedimos
eliminarlo junto con los archivos adjuntos y avisar inmediatamente
al remitente, respondiendo este mensaje. 

"Before printing this e-mail think if is really necesary".
Disclosure: This Message is to be used by the individual,
individuals or entities that it is addressed to and may include
private and confidential information that may not be disclosed,
made public nor used in any way at all. Unauthorized use of the
information in this electronic mail message may be subject to the
penalties set forth by Chilean law. 
If you have received this electronic mail message in error, we ask
you to destroy the message and its attached file(s) and to
immediately notify the sender by answering this message. 

More information about the zeromq-dev mailing list