From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id EA43BBB81 for ; Mon, 13 Feb 2006 20:29:36 +0100 (CET) Received: from mallaury.nerim.net (smtp-101-monday.noc.nerim.net [62.4.17.101]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k1DJTaEM010999 for ; Mon, 13 Feb 2006 20:29:36 +0100 Received: from hector.lesours (bstarynk.net8.nerim.net [213.41.176.170]) by mallaury.nerim.net (Postfix) with ESMTP id EF8914F3BF for ; Mon, 13 Feb 2006 20:29:24 +0100 (CET) Received: from basile by hector.lesours with local (Exim 4.60) (envelope-from ) id 1F8jOC-0001jw-2r for caml-list@yquem.inria.fr; Mon, 13 Feb 2006 20:29:36 +0100 Date: Mon, 13 Feb 2006 20:29:36 +0100 To: caml-list@yquem.inria.fr Subject: (quasi FAQ) object, variants, .... Unbound type parameter [..] Message-ID: <20060213192936.GA6605@ours.starynkevitch.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.5.11+cvs20060126 From: Basile STARYNKEVITCH X-Miltered: at nez-perce with ID 43F0DE20.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; variants:01 basile:01 basile:01 node:01 semantics:01 ml-like:01 syntax:01 nerim:01 faiencerie:01 92340:01 reine:01 ashamed:98 ess:98 unbound:01 unbound:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 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: basilestarynkevitchnet aliases: basiletunesorg = bstarynknerimnet 8, rue de la Faïencerie, 92340 Bourg La Reine, France