Version française
Home     About     Download     Resources     Contact us    
Browse thread
Setting function in a class
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Stéphane Glondu <steph@g...>
Subject: Re: [Caml-list] Setting function in a class
Le 19/07/2010 09:30, Keyan Zahedi a écrit :
> class myclass =
> object
> val mutable _myfunc = (* a function of type string -> bool)
> method set_myfunc f = _myfunc <- f
> method my_func f = _myfunc f
> ;;

I am not sure of what blocks you. Just making your snippet syntactically
correct works:

class myclass =
object
val mutable _myfunc = fun (s:string) -> true
method set_myfunc f = _myfunc <- f
method my_func f = _myfunc f
end
;;


Cheers,

-- 
Stéphane