From: Goswin von Brederlow <goswin-v-b@web.de>
To: Anders Peter Fugmann <anders@fugmann.net>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Who was working on ocaml bindings for zeromq?
Date: Mon, 20 Jan 2014 10:12:43 +0100 [thread overview]
Message-ID: <20140120091242.GC26447@frosties> (raw)
In-Reply-To: <52DC086D.2080508@fugmann.net>
On Sun, Jan 19, 2014 at 06:16:29PM +0100, Anders Peter Fugmann wrote:
> Hi Goswin,
>
> Please see my reply below. For completeness your original mail is
> also included in full at the end of the mail.
>
> On 18/01/14 12:33, Goswin von Brederlow wrote:
> >3) sockets have phantom types, use them
> Agreed.
>
> >4) Polling is ugly
> Indeed this could be made simpler.
Yesterday I actually run into a problem with this. Creating a socket
gave me a odd type (from memory):
val stream: _[> `Push | `Pull | `Pub | `Sub | `Stream] ZMQ.Socket.t
val dealer: _[> `Push | `Pull | `Pub | `Sub | `Dealer] ZMQ.Socket.t
A few problems with that:
1) A stream socket should be just `Stream.
2) Note the _ there. The type is not polymorphic and gives an error
that it can't be unified or something. Don't have the exact error in
memory.
I think there is something wrong with the way the socket types are
specified that cause this. First time I ever got that kind of error.
3) Polling takes an ('a ZMQ.Socket.t, ZMQ.Socket.event) array. Trying
to poll a stream and dealer socket causes type errors.
I think phantom typed sockets are incompatible with putting them into
an array outside the module. This needs an interface where you have a
poller instance and can add sockets to it one at a time. Internally
the phantom type is known to be "phantom" and the sockets can be put
into an array, hashtbl or list.
I didn't have time yet to look into those problems. Currently I used
Obj.magic to make it work because I wanted to work on the application
instead of on zmq. But that certainly isn't a solution.
So in summary: We need a new polling interface (or phantom typing).
Not just because I don't like it but because it doesn't work for
combining different socket types.
MfG
Goswin
next prev parent reply other threads:[~2014-01-20 9:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-13 15:48 Goswin von Brederlow
2014-01-13 15:58 ` Daniel Bünzli
2014-01-16 8:35 ` Goswin von Brederlow
2014-01-16 21:04 ` Anders Peter Fugmann
2014-01-18 11:33 ` Goswin von Brederlow
2014-01-19 17:16 ` Anders Peter Fugmann
2014-01-20 9:12 ` Goswin von Brederlow [this message]
2014-01-20 9:50 ` Gabriel Scherer
2014-01-21 9:59 ` Anders Peter Fugmann
2014-01-13 17:02 ` David Sheets
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140120091242.GC26447@frosties \
--to=goswin-v-b@web.de \
--cc=anders@fugmann.net \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox