Version française
Home     About     Download     Resources     Contact us    
Browse thread
Type problem... possible design problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Type problem... possible design problem
On Sun, 2004-12-19 at 01:28, chris.danx wrote:

> My concern with variants is sharing subgraphs in graphs, will they be 
> shared or copied?

It is up to you. Consider:

match ex with
| `A a -> `A a 
| (`B b ) as x -> x
| x -> x

In the first case, you're making a new object, by executing
the constructor `A. In the second and third you're not.
In all cases, the constructor argument is shared.

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net