* [Caml-list] RFH: type recursion between a class and external functions
@ 2016-03-05 12:12 Goswin von Brederlow
0 siblings, 0 replies; only message in thread
From: Goswin von Brederlow @ 2016-03-05 12:12 UTC (permalink / raw)
To: caml-list
Hi,
are there any nice ways to solve a type recursion between a class and
external functions?
MfG
Mrvn
---
module Proxy = struct
type 'a t
end
class ['a] oMainWindow proxy = object
inherit ['a] OWidget.oWidget proxy
(*
method show = show proxy
method centralWidget =
let widget_proxy = centralWidget proxy
in
new QWidget.qWidget widget_proxy
method setCentralWidget : 'b . 'b OWidget.oWidget -> unit = fun w ->
let widget_proxy = w#proxy
in
setCentralWidget proxy widget_proxy
*)
end
external make : unit -> 'a oMainWindow Proxy.t
= "caml_mrvn_QT5_OMainWindow_make"
let make () =
let proxy = make ()
in
new oMainWindow proxy
external show : 'a oMainWindow Proxy.t -> unit
= "caml_mrvn_QT5_OMainWindow_show"
let show win =
let win = win#proxy
in
show win
external centralWidget : 'a oMainWindow Proxy.t -> 'b OWidget.oWidget Proxy.t
= "caml_mrvn_QT5_OMainWindow_centralWidget"
let centralWidget win =
let win = win#proxy in
let proxy = centralWidget win
in
new OWidget.oWidget proxy
external setCentralWidget : 'a oMainWindow Proxy.t -> 'b OWidget.oWidget Proxy.t -> unit
= "caml_mrvn_QT5_OMainWindow_setCentralWidget"
let setCentralWidget win w =
let win = win#proxy in
let w = w#proxy
in
setCentralWidget win w
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-03-05 12:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-05 12:12 [Caml-list] RFH: type recursion between a class and external functions Goswin von Brederlow
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox