Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] troubles with polymorphic variant in class
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Damien Doligez <damien.doligez@i...>
Subject: Re: [Caml-list] troubles with polymorphic variant in class
On Jun 14, 2004, at 11:29, François-Xavier HOUARD wrote:

> let l = a#get_child in
> match l with
> h::t -> (match h with
> 	 	myGui.User_variant v ->
> 			( match v with
> 			    MyText t -> .......
> 			    | _ ->
> 			)
> 		| _ -> raise Not_found
> 	)
> ....
>
>
> Who the hell would use this ???

You don't really need to obfuscate your own code:

   match a#get_child with
   | MyGui.User_variant (MyText t) :: tt -> .......
   | _ -> raise Not_found
   ....

-- Damien

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners