From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p2JFgZp4021728 for ; Sat, 19 Mar 2011 16:42:35 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ai4EAB5shE3RVdY0kGdsb2JhbACYfIxwCBQBAQIJCRQUBCGoEIpCgh+ERy+IWwEBAwWFXgSMZ4RDhDw6 X-IronPort-AV: E=Sophos;i="4.63,211,1299452400"; d="scan'208";a="90753399" Received: from mail-bw0-f52.google.com ([209.85.214.52]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 19 Mar 2011 16:42:30 +0100 Received: by bwj24 with SMTP id 24so5291607bwj.39 for ; Sat, 19 Mar 2011 08:42:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:user-agent:mime-version :content-type:content-transfer-encoding:message-id; bh=jJhk7Sg4E7161gfQFElsdgkv5gxURkAFGfQPeIXQHgI=; b=KRlEtOEnnNjTQdlXCAc+o76j+lQ7qc5GhFIWQX6BxUXBIs6Wui4ZzbmzFcQn9YtukM gQO2fZg19B9Z9GegbhL+DAFPw4H36vDxg3rgEMe3K2dbREauz1YK9JaV7Euj4y/oYeTn mwW2HRmLA3JFaQswk2LhTb2AbbByplfHOzsQk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:mime-version:content-type :content-transfer-encoding:message-id; b=SLEZrGLwYCFC7d799PnQB0G7cSkBy3CZFSqkmlgapynId32vKyXZXtTDqdfz7+ztng ST8hIpQABAZ4HN6if5UQ66VRe2+nhZ+pZeSd8J/L/bDp6CfiXwY4EyaWHZHHcU73TVT1 lQoAfl2HG6OH5JwXWdg7ZV4y/iAOv7Czb2fWw= Received: by 10.204.47.87 with SMTP id m23mr1987276bkf.156.1300549349226; Sat, 19 Mar 2011 08:42:29 -0700 (PDT) Received: from cloudy.localnet ([85.69.95.49]) by mx.google.com with ESMTPS id k5sm2961724bku.16.2011.03.19.08.42.27 (version=SSLv3 cipher=OTHER); Sat, 19 Mar 2011 08:42:28 -0700 (PDT) From: Raphael Proust To: caml-list@yquem.inria.fr Date: Sat, 19 Mar 2011 16:48:40 +0100 User-Agent: KMail/1.13.6 (Linux/2.6.37-ARCH; KDE/4.6.1; i686; ; ) MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Message-Id: <201103191648.40345.raphlalou@gmail.com> Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p2JFgZp4021728 Subject: [Caml-list] Recursive Parametric class type Typing Hi list, Trying to bind a javascript library for js_of_ocaml, I encountered the following pattern (here drastically simplified): class type ['t] c = object method plus: 't -> unit method minus: unit -> 't method container: unit -> container end and container = object method int: unit -> int c method string: unit -> string c end The following error is raised at compile time: Error: This type string should be an instance of type int In the use case: - instead of [int] and [string] there are six different [class type]s; - [classe type]s have more methods; and - there are additional recursive [class type]s Why is there such a limitation on the types? Is there a work around that wouldn't induce (too much) code duplication? Thanks, -- ______________ Raphaël Proust