Browse thread
[Caml-list] lablgtk polymorphic variants question
-
Ruchira Datta
- Sven LUTHER
- Jacques Garrigue
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jacques Garrigue <garrigue@k...> |
| Subject: | Re: [Caml-list] lablgtk polymorphic variants question |
From: Ruchira Datta <datta@math.berkeley.edu>
> I tried to compile lablgtkmathview but ran into an error. I would guess
> that it probably compiled under OCaml 3.00 but doesn't for me since I have
> 3.01. I have lablgtk 1.2.0. (Everything is from Sven Luther's Debian
> packages, except lablgtkmathview and mlminidom which don't seem to be
> packaged yet.) The error:
[...]
> The declaration of MathView.get_frame is on lines 85-86 of gtkMathView.ml,
> in module MathView:
>
> external get_frame : [>`math_view] obj -> [`frame] obj =
> "ml_gtk_math_view_get_frame"
This is wrong. This should be:
external get_frame : [>`math_view] obj -> Gtk.frame obj =
"ml_gtk_math_view_get_frame"
> The declaration of Gtk.frame is on line 95 of gtk.ml:
>
> type frame = [`widget|`container|`bin|`frame]
>
> I guess I don't fully understand polymorphic variants. It would have seemed
> to me that if (new GBin.frame) expects an argument of type Gtk.frame, then
> something of type [ 'frame] should satisfy it. Why should it be necessary
> that all four variants [`widget|`container|`bin|`frame] be able to occur?
> I thought that the inferred type of a function would always allow less
> variants in its argument.
LablGTK uses an encoding of widget types, in variant types, were
variant types are used as capacities. This can seem a bit unusual, but
you can see it in the fact the Gtk.obj abstract type is contravariant.
Jacques Garrigue
-------------------
To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr