Version française
Home     About     Download     Resources     Contact us    
Browse thread
lablgtk2: receiving messages from network?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] lablgtk2: receiving messages from network?
From: "Ivan Matveich" <ivan.matveich@gmail.com>

> Now I have another question. I've started writing some code,
> 
> module Channel =
>   struct
>     type event =
>       | Connected of Unix.sockaddr
>       | Dropped of Unix.sockaddr
>       | Received of Unix.sockaddr * x
>       | Sent of Unix.sockaddr * x
>     type action =
>       | Associate of Unix.sockaddr
>       | Dissociate of Unix.sockaddr
>       | Send of Unix.sockaddr * x
> 
> where x will be something returned by Marshal.from_string.
> 
> How do I properly specify its type?

I suppose x should be Obj.t, meaning that you're going to use Obj.repr
and Obj.obj. This is clearly unsafe, but any use of Marshal is.

Jacques Garrigue