From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id DB3207ED7A for ; Fri, 21 Sep 2012 18:47:19 +0200 (CEST) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of dhouse@janestreet.com) identity=pra; client-ip=38.105.200.115; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="dhouse@janestreet.com"; x-sender="dhouse@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of dhouse@janestreet.com designates 38.105.200.115 as permitted sender) identity=mailfrom; client-ip=38.105.200.115; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="dhouse@janestreet.com"; x-sender="dhouse@janestreet.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@nyc-dmz-mxout2.janestreet.com) identity=helo; client-ip=38.105.200.115; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="dhouse@janestreet.com"; x-sender="postmaster@nyc-dmz-mxout2.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao4BAO+YXFAmachzl2dsb2JhbABFrCiRZisBAQEBAQgWBzuCIAEBAQQSAiwBASwLAQ8LCw0NISEBEgEFAQoSBhMIChCHUQMPAwEHmlAJA4pohDIBBYVaAwqJTQaKOmKGJpQSgVWBFYoDgysWKYQIghY X-IronPort-AV: E=Sophos;i="4.80,463,1344204000"; d="scan'208";a="156550837" Received: from mx2.janestreet.com (HELO nyc-dmz-mxout2.janestreet.com) ([38.105.200.115]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 21 Sep 2012 18:47:18 +0200 Received: from nyc-qsv-mail1.delacy.com ([172.25.22.57]) by nyc-dmz-mxout2.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1TF6Nq-0008M8-5t for caml-list@inria.fr; Fri, 21 Sep 2012 12:47:18 -0400 Received: from nyc-dmz-mxgoog1.delacy.com ([172.25.224.109] helo=mxgoog1.janestreet.com) by nyc-qsv-mail1.delacy.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1TF6Nq-0001gP-4Z for caml-list@inria.fr; Fri, 21 Sep 2012 12:47:18 -0400 Received: from mail-qa0-f54.google.com ([209.85.216.54]) by mxgoog1.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1TF6Nq-0002Vc-2d for caml-list@inria.fr; Fri, 21 Sep 2012 12:47:18 -0400 Received: by qady23 with SMTP id y23so1764028qad.6 for ; Fri, 21 Sep 2012 09:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=ZRUPkwupT3K0fCFjsRy/eNhSbPNwOYz/mIYV/ouf15c=; b=KzLqDnYw862w8tHEQR91tUcIKuBqcddgO//EQKLaH0Dfjmhzhf93t1xVfn8gNI9Gak cejES++GORrqaDHB8/yqdX57C0NpDP2fFlg29REb2zhoeM614mdr5fgsMs0pFPuBrb42 3RUX+Kg+LTRX/OeyAADjxRm6OoJ/rDYp2rKVQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=ZRUPkwupT3K0fCFjsRy/eNhSbPNwOYz/mIYV/ouf15c=; b=RzvbfrxZ5h+8etc9IO5I1ps0gsJcGkN/1fJ4Z8Py3Gc6uDkryY6HTjzBLVmGkkp6+3 fXpXo1lRyg5ICwB1iNqHAThhVCbSCy+A1hE9vbu9i2AdjjMi8S40SVo/AVED+BDNFH+U NksIwmyTh9N1kPqVLGCe6376fMdIpY7+HOkse0wUPtapT2sfHjdOH0+IJ8Coe3THxGtK SDHE+wjvIDzier2YHLVZdpa5igndMXCpQz6y5nmrvieGsXPigRVP+tSr9/JBIPC+CmSv vkwfhYGqz/LwQfLiEvSgbl4Wye5EcsXfoUBwAUk5gd+rHuncKcUzM/f17V9vtAGldS5i 4dvA== MIME-Version: 1.0 Received: by 10.224.59.129 with SMTP id l1mr13279308qah.97.1348246037562; Fri, 21 Sep 2012 09:47:17 -0700 (PDT) Received: by 10.49.6.7 with HTTP; Fri, 21 Sep 2012 09:47:17 -0700 (PDT) X-Originating-IP: [80.169.196.210] In-Reply-To: <4C5580B1-5737-40ED-B7B4-83ACFFAD491B@gmail.com> References: <3371F9A1-1248-42DC-9761-8A7797A1C1D1@gmail.com> <4C5580B1-5737-40ED-B7B4-83ACFFAD491B@gmail.com> Date: Fri, 21 Sep 2012 17:47:17 +0100 Message-ID: From: David House To: Pierre-Etienne Meunier Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQl0i28Ty0+jTBzNI7OdC3uqrQq3mFCNtAqYw6rnwzXPGOJmK5FkpjpVchvLUpE9fwjLvjxq Subject: Re: [Caml-list] Partial module include Ah, no, that cannot be done. Shadowing of modules is mysteriously disallowed :) (I suspect there is a good reason for this, but I confess I don't know it.) If you say what you want to do with a bit more context, there might be a decent workaround. On Fri, Sep 21, 2012 at 5:43 PM, Pierre-Etienne Meunier wrote: > No, sorry, what I wanted to override was a module: > > module A=3Dstruct > let a=3D0 > module B=3Dstruct let b=3D1 end > end > > module B=3Dstruct > include A > module B=3Dstruct let b=3D2 end > end > > > Em 21/09/2012, =E0s 18:41, David House escreveu: > >> Sure. That exact code will work just fine. >> >> It's a special case of "shadowing", where bindings override any >> previous ones, for the duration of their scope. E.g.: >> >> let x =3D 5 in >> let x =3D 4 in >> (* here x is 4 *) >> >> also: >> >> let x =3D 5 in >> let () =3D >> let x =3D 4 in >> printf "%d " x >> in >> printf "%d\n" x >> >> Prints "4 5", because the inner binding only has effect during the >> time that it is in scope, and afterwards the original binding is >> "uncovered" again. >> >> On Fri, Sep 21, 2012 at 5:37 PM, Pierre-Etienne Meunier >> wrote: >>> Hi, >>> >>> Is it possible in ocaml to redefine a part of an included module, like = in the following code ? >>> >>> module A=3Dstruct >>> let a=3D0 >>> let b=3D1 >>> end >>> >>> module B=3Dstruct >>> include A >>> let b=3D2 >>> end >>> >>> >>> Thanks >>> Pierre >>> -- >>> Caml-list mailing list. Subscription management and archives: >>> https://sympa-roc.inria.fr/wws/info/caml-list >>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >>> Bug reports: http://caml.inria.fr/bin/caml-bugs >>> > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >