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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id C9462BC57 for ; Wed, 21 Jul 2010 15:38:46 +0200 (CEST) X-IronPort-AV: E=Sophos;i="4.55,238,1278280800"; d="vcf'?scan'208";a="55931702" Received: from pc-50072.rocq.inria.fr (HELO [128.93.50.72]) ([128.93.50.72]) by mail2-relais-roc.national.inria.fr with ESMTP; 21 Jul 2010 15:38:46 +0200 Message-ID: <4C46F866.9050900@inria.fr> Date: Wed, 21 Jul 2010 15:38:46 +0200 From: Dumitru Potop-Butucaru Reply-To: dumitru.potop@inria.fr Organization: INRIA Rocquencourt, France User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: caml-list@inria.fr Subject: Bug in the module system of version 3.12.0+beta1 Content-Type: multipart/mixed; boundary="------------070608050302080605090107" X-Spam: no; 0.00; bug:01 bug:01 struct:01 sig:01 functor:01 sig:01 val:01 val:01 struct:01 syntax:01 variants:01 syntaxes:01 transforming:01 bugfix:01 int:01 X-Attachments: cset="utf-8" name="dumitru_potop_butucaru.vcf" name="dumitru_potop_butucaru.vcf" This is a multi-part message in MIME format. --------------070608050302080605090107 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hello, I started several days ago to use version 3.12.0+beta1 (at the suggestion of a colleague to whom I explained what I need). I have one main problem, which I see as a bug. The code I want to write is the following: module IntList = Set.Make(struct type t=int let compare x y = x-y end) ;; module type Simple = sig type t end ;; module type Abc = functor (M:Simple) -> sig val x : M.t end ;; module MyModule : sig include Abc(module type of IntSet) val y : int end = struct let x = IntSet.empty let y = 0 end ;; The code gives a syntax error on the include line of the signature of MyModule. I also tried several variants of the code, including: include Abc(IntSet) instead of the rejected include or module type TTT = Abc(IntSet) ;; ... include TTT In the manual, it appears that these syntaxes are indeed not permitted, which I think is a bug, given that converting all module types to full module makes everything work smoothly: module IntList = struct include Set.Make(struct type t = int let compare x y = x - y end) let zero = empty end ;; module type Simple = sig type t val zero : t end ;; module Abc (M:Simple) : sig val x : M.t end = struct let x = M.zero end ;; module MyModule : sig include module type of Abc(IntList) val y : int end = struct let x = IntList.empty let y = 10 end ;; Of course, transforming module types into modules just for the purpose of writing "module type of " defeats the very purpose of interfaces (this is why I think this is a bug, not a feature). Can someone help me (e.g., with a bugfix)? Yours, Dumitru --------------070608050302080605090107 Content-Type: text/x-vcard; charset=utf-8; name="dumitru_potop_butucaru.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="dumitru_potop_butucaru.vcf" begin:vcard fn:Dumitru Potop-Butucaru n:Potop-Butucaru;Dumitru org:INRIA Rocquencourt;Project AOSTE adr:;;Domaine de Voluceau, BP 105;Le Chesnay;;F-78153;France email;internet:dumitru.potop@inria.fr tel;work:+33-139.63.55.80 x-mozilla-html:FALSE url:http://www.DumitruPotop.net version:2.1 end:vcard --------------070608050302080605090107--