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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 9090E7F168 for ; Thu, 27 Aug 2015 15:34:13 +0200 (CEST) IronPort-PHdr: 9a23:aXQv9hPzXCiODUHZev8l6mtUPXoX/o7sNwtQ0KIMzox0Kf36rarrMEGX3/hxlliBBdydsKIfzbSK+P64EUU7or+/81k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ35/xibz5pcWbSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6LoJvvRNWqTifqk+UacQTHF/azh0t4XXskzySheG4zM2W38QlQsAVxnC8Bj/VJ7rtCzrnuV40Siee8bxSOZwEROp5qJvADrhiSMGMTFx1GDMloQkh6tepFelpgdj64/SeoCccvRkKPDzZ9QfEEZbQ94ZAyBbH5utaIRMBOMEOc5KqIn64VAJqE3tVkGXGOrzx2oQ1TfN1qog3rFkSFme0Q== Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=drupyog+caml@zoho.com; spf=Pass smtp.mailfrom=drupyog+caml@zoho.com; spf=None smtp.helo=postmaster@sender153-mail.zoho.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of drupyog+caml@zoho.com) identity=pra; client-ip=74.201.84.153; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="drupyog+caml@zoho.com"; x-sender="drupyog+caml@zoho.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of drupyog+caml@zoho.com designates 74.201.84.153 as permitted sender) identity=mailfrom; client-ip=74.201.84.153; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="drupyog+caml@zoho.com"; x-sender="drupyog+caml@zoho.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@sender153-mail.zoho.com) identity=helo; client-ip=74.201.84.153; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="drupyog+caml@zoho.com"; x-sender="postmaster@sender153-mail.zoho.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A7BQAgEd9VlJlUyUpdhFiDI6g+khoBBodyAoEvPg4BAQEBAQEBARABAQEBCQkLCR8wgh2CBwEBBCMPAQULATcOCxoCBSECAg8CRgYBDAgBAYgUAQMBBA2yOnGEawKKIiIoJYUXAQEIAQEBAQEWB4Eiij+FEoJpgUOVQoFFiy6DAYV2kWmEJ2+CTQEBAQ X-IPAS-Result: A0A7BQAgEd9VlJlUyUpdhFiDI6g+khoBBodyAoEvPg4BAQEBAQEBARABAQEBCQkLCR8wgh2CBwEBBCMPAQULATcOCxoCBSECAg8CRgYBDAgBAYgUAQMBBA2yOnGEawKKIiIoJYUXAQEIAQEBAQEWB4Eiij+FEoJpgUOVQoFFiy6DAYV2kWmEJ2+CTQEBAQ X-IronPort-AV: E=Sophos;i="5.17,422,1437429600"; d="scan'208";a="175067580" Received: from sender153-mail.zoho.com ([74.201.84.153]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-SHA; 27 Aug 2015 15:34:12 +0200 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=subject:to:references:from:message-id:date:user-agent:mime-version:in-reply-to:content-type; b=Avtgb7piD7CawWFfZJTBcAoYOZAvEK6B5AoBqu/zXAbdb6RHiBFWoGYzMUkwtc8b0GtWTCPsTMD4 TrFs1OAr/bwjP7zDPTkmjKy22N9TEQaxkbztlASSHrejc9GM1Wka Received: from [172.17.158.95] (global-1-26.nat.csx.cam.ac.uk [131.111.184.26]) by mx.zohomail.com with SMTPS id 1440682447646332.4467517523442; Thu, 27 Aug 2015 06:34:07 -0700 (PDT) To: Yotam Barnoy , Ocaml Mailing List References: From: Drup Message-ID: <55DF11AC.10204@zoho.com> Date: Thu, 27 Aug 2015 15:33:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Caml-list] Expanding functors Le 27/08/2015 15:29, Yotam Barnoy a écrit : > One problem I've commonly encountered in OCaml is the inability to > expand the interface of functors after they've been created (I'm not > talking about post-application). For example, Map.Make in the stdlib > takes an OrderedType module which contains only the compare function. > What happens if I want to add something to this interface, such as a > show function? I have to copy the whole implementation of Map.Make > into my own file to modify it. Compare this to the ability to > 'include' a regular module and just add the new functionality, and to > take the type of a module and expand that type as needed. Functors are > severely lacking in this regard. > > What do people think of this idea -- of allowing functors to be > expanded? Ideally, expanding a functor would allow for both replacing > its argument type (as in the example I gave) and for adding a > second/third functor argument type (so Map.Make(OrderedType) would > become Map.Make(OrderedType)(Show). > > -Yotam module Make(O : Map.OrderedType) = struct include Map.Make(O) let foo = .... end You successfully extended Map without breaking anyone's code !