From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p4G8vZfG030047 for ; Mon, 16 May 2011 10:57:35 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlgDACLm0E1KfVI0kGdsb2JhbACmCggUAQEBAQkJDQcUBCGIcKIGjBqCNYQmN4hiAQEDBoYTBJARhC+BEYVFO4M3 X-IronPort-AV: E=Sophos;i="4.64,373,1301868000"; d="scan'208";a="83269843" Received: from mail-ww0-f52.google.com ([74.125.82.52]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 16 May 2011 10:57:29 +0200 Received: by wwb31 with SMTP id 31so5718391wwb.9 for ; Mon, 16 May 2011 01:57:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to:x-mailer; bh=leOxkLoAb5BunlukbOQUybZRMgX0yGIvqCFiK0otHEU=; b=CcARWeabU++UFqQhJO88/Ij0r5RZLak8QbOPslIlosjkwPaIW/TczI9MYBPdIioRoP dVihjICHGMdBXCcygk1JxjaEq/kO5t/hif/VI3KnaIo+7KJuTcbrHRfZZ/O3t3YGXdB0 fEmGn4U+0h6FoeRyFhp9tEmzMjNKINnnL4HFc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=uAZHDZcahIj9oxyLenm9x/OL5gNHcY5cs2XK+EM8ZnjjojmtJ2CehV9QZT13qC3ATR zEo7EMROxrAOH96tVni4/W0McisVW3DiyX6ZCGLmPpoFoQb5PWbqvyxVXKVuJ4HBZC8q Sc6yfZIqrlYtdGR/PTe8lUQ/bkhproxolIK24= Received: by 10.216.254.90 with SMTP id g68mr3981893wes.16.1305536249286; Mon, 16 May 2011 01:57:29 -0700 (PDT) Received: from [10.0.1.31] ([87.54.60.37]) by mx.google.com with ESMTPS id f52sm2438886wes.35.2011.05.16.01.57.27 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 May 2011 01:57:27 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Joel Reymont In-Reply-To: Date: Mon, 16 May 2011 10:57:25 +0200 Cc: Goswin von Brederlow , caml-list Message-Id: <201E7541-5F67-44C7-95C5-CCCAB2226DCA@gmail.com> References: <87wrhr9n88.fsf@frosties.localnet> To: Gabriel Scherer X-Mailer: Apple Mail (2.1084) Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p4G8vZfG030047 Subject: Re: [Caml-list] do i need a private row type? On May 16, 2011, at 9:07 AM, Gabriel Scherer wrote: > If "call" is the only thing you wish to do on your array, you don't need such an ugly solution. "sock" and "mask" being constants for a given item, you can simply capture them in a closure. All I want to do (and must do) is call "poll" on the poll item set. There are no callbacks since I'm checking to see what socket has data and then issuing a "receive data" call on that socket. > Joel must have an use case in mind which is actually type-safe; maybe it's only the callback as you demonstrated (I fail to see its usefulness, but I don't know anything about ZeroMQ), maybe it's something a bit more complicated. But we won't be able to give him a satisfying solution unless he describes more precisely what this type-safe use is. My type safe use is exactly what Unix select does, i.e. determine what socket has data available. > Joel, may you be more explicit as to what you want to do with those "poll_item" array. More precisely, how do you plan to *use* the data in the array? I need to check the mask for each item in the returned array to see what socket has data. Then I need to read data from the socket. I suspect I'll need to change how the socket is typed to convert to a variant of socket types which can be stored easily into a poll set. I really don't know why Socket is typed as it is, maybe Pedro (the creator of ocaml-zmq) can explain. Thanks, Joel -------------------------------------------------------------------------- - for hire: mac osx device driver ninja, kernel extensions and usb drivers ---------------------+------------+--------------------------------------- http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont ---------------------+------------+---------------------------------------