caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
To: datta@math.berkeley.edu
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] lablgtk polymorphic variants question
Date: Mon, 19 Mar 2001 19:27:36 +0900	[thread overview]
Message-ID: <20010319192736S.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: <20010318221350.A20863@blue1.berkeley.edu>

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


  parent reply	other threads:[~2001-03-19 10:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-19  6:13 Ruchira Datta
2001-03-19  9:43 ` Sven LUTHER
2001-03-19 13:58   ` Stefano Zacchiroli
2001-03-19 10:27 ` Jacques Garrigue [this message]
2001-03-19 17:33 Ruchira Datta
2001-03-20  5:23 Ruchira Datta
2001-03-20 14:03 ` Jacques Garrigue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010319192736S.garrigue@kurims.kyoto-u.ac.jp \
    --to=garrigue@kurims.kyoto-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=datta@math.berkeley.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).