* [Caml-list] Class Events
@ 2002-01-15 18:37 Warp
2002-01-15 18:56 ` Remi VANICAT
0 siblings, 1 reply; 2+ messages in thread
From: Warp @ 2002-01-15 18:37 UTC (permalink / raw)
To: OCaml
Hello, i'm trying to have my class having some event callback like this :
class wmenuitem (fcallback:wmenuitem->unit) =
object(self)
val func = fcallback
method activate = (func self)
end
but I'm having :
This expression has type < activate : 'a; .. > but is here used with type
wmenuitem = < .. >
Self type cannot escape its class
Is it really true that self cannot be a parameter ?
Any help ?
Thanks
Warp
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] Class Events
2002-01-15 18:37 [Caml-list] Class Events Warp
@ 2002-01-15 18:56 ` Remi VANICAT
0 siblings, 0 replies; 2+ messages in thread
From: Remi VANICAT @ 2002-01-15 18:56 UTC (permalink / raw)
To: caml-list
"Warp" <warplayer@free.fr> writes:
> Hello, i'm trying to have my class having some event callback like this :
>
> class wmenuitem (fcallback:wmenuitem->unit) =
> object(self)
> val func = fcallback
> method activate = (func self)
> end
>
> but I'm having :
>
> This expression has type < activate : 'a; .. > but is here used with type
> wmenuitem = < .. >
> Self type cannot escape its class
>
> Is it really true that self cannot be a parameter ?
> Any help ?
Yes : let the compiler guess the type :
class wmenuitem (fcallback:'a -> unit) =
object(self)
val func = fcallback
method activate = (func self)
end
--
Rémi Vanicat
vanicat@labri.u-bordeaux.fr
http://dept-info.labri.u-bordeaux.fr/~vanicat
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-01-15 18:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-15 18:37 [Caml-list] Class Events Warp
2002-01-15 18:56 ` Remi VANICAT
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox