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 pA8Fnxfs009075 for ; Tue, 8 Nov 2011 16:50:00 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkkBAHFOuU7RVde2kGdsb2JhbABDqX8IIgEBAQEJCQ0HFAQhgXIBAQEEEgIsATkDDAEFBQsNLiEBEgEFARwGARIioW0KjkSFb4ktAgUKiSMEiAuMFopAgwE9gUmCRQ X-IronPort-AV: E=Sophos;i="4.69,477,1315173600"; d="scan'208";a="117672435" Received: from mail-ey0-f182.google.com ([209.85.215.182]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 08 Nov 2011 16:49:59 +0100 Received: by eyd10 with SMTP id 10so804590eyd.27 for ; Tue, 08 Nov 2011 07:49:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; bh=WTwryiJdsLbU5E0eIz+4ZMEzUiItC+XtXTbQvax7h68=; b=nR8HmugYMgkpE2Alo4Hf+Ed+5eeRtIJWraa3wyPKwnL70jFtAP4y6bxpRGmcOuparu juubFE/f3v6Pw7DLFbQJ8cwvZpdrU6Gvn7yKC+C8IU+tXYIiEcvt6QuzzxYRgDTcO95I B+fGjayOGoZG3nDIXgAAxVlku3XoRp1J1pgKE= Received: by 10.182.73.7 with SMTP id h7mr10227796obv.51.1320767399142; Tue, 08 Nov 2011 07:49:59 -0800 (PST) MIME-Version: 1.0 Sender: dapilki@gmail.com Received: by 10.182.122.5 with HTTP; Tue, 8 Nov 2011 07:49:38 -0800 (PST) In-Reply-To: References: From: Alexandre Pilkiewicz Date: Tue, 8 Nov 2011 10:49:38 -0500 X-Google-Sender-Auth: sp2glb53ualWXQZewNjFAecJhr0 Message-ID: To: Hans Ole Rafaelsen , caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] Include question On Tue, Nov 8, 2011 at 10:10 AM, Gabriel Scherer wrote: > If you want some module of your system to be parametrized by another > module (to be able to pass either a concrete module or a mockup > module), you should use a functor. And if you don't want to pollute your entire code with functor when it's in fact for testing and not part of the logic of the application, you can use the "functor of the poor": you put your net_lib.ml in a "real_src" sub directory, and the mockup net_lib.ml (same name) in "mockup_src", and then you change wich subdir is in the path. Less pretty, but less invasive too! Other dirty option (yerk): you put your net_lib module in a reference over a first class module, and you dynamically change it to point to the mockup version when you want to test it (but this will probably not work in many situations, like with abstract types)