[zeromq-dev] conventions in bindings

MinRK benjaminrk at gmail.com
Wed Feb 1 01:22:37 CET 2012


On Tue, Jan 31, 2012 at 15:43, john skaller
<skaller at users.sourceforge.net>wrote:

>
> On 01/02/2012, at 9:17 AM, MinRK wrote:
>
> >
> > In terms of nomenclature, should bindings follow the czmq convention of
> using Frame to refer to a message part, or Message, following libzmq?
>
> IMHO the terminology here is a bit confusing.  First, "frame" is a bad
> word to use because that is
> a technical term which refers to "on the wire" packaging of data.
>
> I would use terms like:
>
> MessageContainer: the zmq object
> MessageBuffer: the char array which might be used to hold a message
> Message: the actual bytes of user data
> MessagePart: some of the actual bytes of user data.
>

Even this is a bit confusing to me.  I don't see what the difference is
between Message and MessageContainer, as zmq itself has no such object- it
is strictly implied from the use of SND/RCVMORE flags.  I do like the
clarity of MessagePart as the name for a segment of a message, avoiding
ambiguity of Message and apparently of Frame as well.


>
> In Python you'd never see a MessageBuffer, but you see them in C.
>

Not quite true - right now, you can call buffer(Message), which returns the
CPython wrapper for direct-access to memory.  This is how we are able to do
zero-copy send/recv of numpy arrays, and is of significant value when
sending large messages.


>
> The Felix binding supports zmq_msg_t  but I never use them,
> the interface is too low level to bother with unless you're needing
> ultra-performance.
>
> I use the higher level "send_string" and "recv_string" and for multi-part
> messages "send_strings" and "recv_strings".
>
>
> > 2. SOCKOPT defaults
> >
> > Default values vary, and czmq makes some choices that differ from libzmq:
> >
> > * SUB sockets default to SUBSCRIBE("") instead of None
> > * LINGER is a property of the Context, and sets a default value for its
> sockets, which is 0 by default, instead of -1
> >
> > Should other bindings follow these conventions?
>
> Each binding has to follow conventions suitable to the language.
>
> Felix is a C like language with an ML like type system.
> The socket options are supported by proper variant types.
>
> No options of anything have directly accessible integer values,
> they're mainly either abstract or variant (union) types.
>
> Other changes: I am tending to standardise times in Felix
> as a float double in seconds (since Epoch). So I use that
> instead of whatever ZMQ uses.
>

That makes sense, but is actually orthogonal to my question.  czmq makes
*API calls* (setsockopt) as a part of constructors and some other
functions.  I am asking if we should define these calls as official
convention for bindings, or even explicitly recommend against them.


>
> > 3. shutdown
>
> And socket closure .. always a PITA in any language.
>
>
> --
> john skaller
> skaller at users.sourceforge.net
>
>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120131/03c3161a/attachment.htm>


More information about the zeromq-dev mailing list