[zeromq-dev] Introducing Caravan: Simple, Faithful ZMQ-Bindings for Objective Caml (Pedro Borges)
Brian Ledger
bpl29 at cornell.edu
Mon Apr 4 20:38:27 CEST 2011
>I'm almost convinced to fork Caravan add whatever is missing, and make an
higher level api on top that would be distributed with Caravan (in the
spirit of ZMQ utils). The only conditions I make is that the socket types
must be interoperable (without casting functions) between the two apis and
the uint64 vs int64 thing must be settled.
You are mistaken on the int64 issue. The OCaml Int64 API states that
arithmetic is carried out modulo 2^64, just like an unsigned int, which does
not have to use a sign bit from it's allocation. However, the Int64 still
supports negative integers (probably by an additional sign bit) and so we
must coerce the Int64 from it's range of [-2^64,2^64] to the uint64 range of
[0,2^64]. Thus a uint64 from C can be embedded into an Int64 in OCaml.
I don't think I quite understand the clause concerning interoperable socket
types for our two APIs. Because sockets cannot be passed between threads,
the only scenario I can foresee in which this would be problematic is if
someone was using both of our APIs at the same time in the same application.
However, it is clear from these late discussions that my opaquely typed
socket implementation is problematic, being a simply cast pointer from C to
an appropriate socket. I admit, that was an early design decision whose
implications were not yet fully clear to me. I would welcome a more
sophisticated implementation to be plugged into it's place (perhaps
OCaml-ZMQs?) but I am still unsure of the necessity for any explicit types
to be attached to it, or if the OCaml type-system should encompass such
errors as this may prevent.
I haven't time now to address much more, but Guillaume mentioned that I had
forgotten to implement poll, to which I reply "Oh no!" I had completely
overlooked that function in the API, I think filtering it as an explanatory
document from the reference page.
--
Brian Ledger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110404/c58ae186/attachment.htm>
More information about the zeromq-dev
mailing list