Version française
Home     About     Download     Resources     Contact us    
Browse thread
Structural subtyping problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Vincent Aravantinos <vincent.aravantinos@g...>
Subject: Re: [Caml-list] Structural subtyping problem
Hi, the following seems to do the trick  (?) :

Le 28 mars 10 à 18:38, Dario Teixeira a écrit :

> let rec step1 ?story () = match story with
> 	| Some s -> step2 s#title
> 	| None   -> step2 "title1"
>
>
> and step2 title =
> 	let story =
> 		object
> 			method title = title
> 			method count = 0
> 		end
> 	in step3 ~story
>
>
> and step3 ~story = match story#count with
> 	| 0 ->
>>
-		step1 ~story ()
+               step1 ~story:(story :> <title : string>) ()
> 	| 1 ->
> 		let story =
> 			object
> 				method title = "title2"
> 			end
> 		in step1 ~story ()
> 	| _ ->
> 		true

Cheers,
--
Vincent Aravantinos - PhD Student - Laboratory of Informatics of  
Grenoble
http://membres-lig.imag.fr/aravantinos/