From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id 7C63E7F1DD for ; Fri, 11 Jan 2013 06:27:09 +0100 (CET) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of berenger@riken.jp) identity=pra; client-ip=134.160.33.162; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="berenger@riken.jp"; x-sender="berenger@riken.jp"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of berenger@riken.jp designates 134.160.33.162 as permitted sender) identity=mailfrom; client-ip=134.160.33.162; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="berenger@riken.jp"; x-sender="berenger@riken.jp"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of postmaster@postman.riken.jp designates 134.160.33.162 as permitted sender) identity=helo; client-ip=134.160.33.162; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="berenger@riken.jp"; x-sender="postmaster@postman.riken.jp"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArIAANGh71CGoCGimWdsb2JhbABEqxOSew4BAQEBAQgLCwcUJ4IeAQEEATg2CgEFCwsYCQQSDwkDAgECATMSBg0BBQIBAQ6HdQMJBgyuCgOGZpEfA4hejSyBHIRPjWI X-IronPort-AV: E=Sophos;i="4.84,449,1355094000"; d="scan'208";a="189384094" Received: from postman2.riken.jp (HELO postman.riken.jp) ([134.160.33.162]) by mail1-smtp-roc.national.inria.fr with ESMTP; 11 Jan 2013 06:27:07 +0100 Received: from postman.riken.jp (postman2.riken.jp [127.0.0.1]) by postman.riken.jp (Postfix) with SMTP id D848B126051F; Fri, 11 Jan 2013 14:27:04 +0900 (JST) Received: from [172.27.98.103] (rikad98.riken.jp [134.160.214.98]) by postman.riken.jp (Postfix) with ESMTPA id 48A261270051; Fri, 11 Jan 2013 14:27:04 +0900 (JST) Message-ID: <50EFA29E.6010704@riken.jp> Date: Fri, 11 Jan 2013 14:26:54 +0900 From: Francois Berenger User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: caml-list CC: Siraaj Khandkar References: <50EF9E2B.1010100@riken.jp> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version: 5.6.0.2009776, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2013.1.11.51521 Subject: Re: [Caml-list] adding a function to an already existing module On 01/11/2013 02:14 PM, Siraaj Khandkar wrote: > module MyList = struct > include List > > let foo l = bar l > end Not exactly, because: module MyList = struct include List let expose_length_aux = length_aux (* stupid example *) end gives: Error: Unbound value length_aux While length_aux is available to code from list.ml. > On Jan 11, 2013, at 0:07, Francois Berenger wrote: > >> Hello, >> >> Let's say I want to add a function to the List module >> of the std lib. >> >> I'd like to do this without having to change list.ml >> in the std lib. >> >> And, my function need to have access to everything available >> in list.ml (constructors, type names, etc.). >> >> Is this possible and how to do this? >> >> For example, I want to create MyList, and this module >> is the exact List module plus some functions of my own. >> Then, some of my code would use MyList instead of List. >> >> Thanks a lot, >> F. >> >> PS: a full copy-paste of list.ml is considered cheating ;) >> >> -- >> Caml-list mailing list. Subscription management and archives: >> https://sympa.inria.fr/sympa/arc/caml-list >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs