Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2004-12-20 (11:50)
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,
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language