caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Basile STARYNKEVITCH <basile@starynkevitch.net>
To: caml-list@yquem.inria.fr
Subject: (quasi FAQ) object, variants, .... Unbound type parameter [..]
Date: Mon, 13 Feb 2006 20:29:36 +0100	[thread overview]
Message-ID: <20060213192936.GA6605@ours.starynkevitch.net> (raw)


Hello All,

I'm a bit ashamed to ask such a quasi FAQ, but I don't understand why
the following does not compile


  class virtual ['VarT,'NodeT] myclass = object(self)
    method virtual v : 'VarT
    method virtual n : 'NodeT
  end;;

  type 
    'a vart = [> `NothingV | `IntegerV of int | `NodeV of 'a nodet ]
  and
    'a nodet = Empty | LeafI of int | ObLeaf of 'a instancet | Node of nodet list
  and
    'a instancet = ('a,nodet) myclass constraint 'a = 'a vart


I'm getting the following error

File "ess.ml", line 8, characters 12-66:
Unbound type parameter [..]

which is positionned inside the bracket [] of vart line.

Sorry for asking such a nearly FAQ; I thought that this would be a
nearly canical example of the use of constraint.

The real context of all this is some scriptable Wiki-like application
which contains a (dynamically typed) interpreter (quasi scheme
semantics with some ml-like or ada-like syntax). The actual need is to
box in an open variant type (like vart above) all the "special" values
of the interpreter.


Again, my apologies for asking a nearly FAQ... (I googled a bit, but
did not understood the relation between the answers & my question).

Regards

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France


             reply	other threads:[~2006-02-13 19:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-13 19:29 Basile STARYNKEVITCH [this message]
2006-02-13 20:43 ` [Caml-list] " Martin Jambon
2006-02-14  0:04 ` 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=20060213192936.GA6605@ours.starynkevitch.net \
    --to=basile@starynkevitch.net \
    --cc=caml-list@yquem.inria.fr \
    /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).