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 5EC967EDC2 for ; Wed, 21 Nov 2012 04:39:56 +0100 (CET) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of bobzhang1988@gmail.com) identity=pra; client-ip=209.85.220.182; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="bobzhang1988@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of bobzhang1988@gmail.com designates 209.85.220.182 as permitted sender) identity=mailfrom; client-ip=209.85.220.182; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="bobzhang1988@gmail.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@mail-vc0-f182.google.com) identity=helo; client-ip=209.85.220.182; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="postmaster@mail-vc0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ar0CAL1LrFDRVdy2m2dsb2JhbABEhVm8dQgWDgEBAQEBCAkLCRQngh4BAQEEAQEBJBEIARscAQEDDAYFCw0JFg8JAwIBAgEREQEFARwGDQEFAgEBh3YBAw+gSIwxgW6BCoULChknDVmIdQEFDJEKA4hchTSHboEcjUU/hC4 X-IronPort-AV: E=Sophos;i="4.83,290,1352070000"; d="scan'208";a="163216905" Received: from mail-vc0-f182.google.com ([209.85.220.182]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 21 Nov 2012 04:39:55 +0100 Received: by mail-vc0-f182.google.com with SMTP id fo13so12584250vcb.27 for ; Tue, 20 Nov 2012 19:39:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:newsgroups:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=6N/JpKiLaoCIAcAEsRVVZJqNNgyUBoTkXzmzz+0q7N0=; b=tle7SshOfjWnkX8kO1cjxpa+50P3P75RoFm5aTH+p23iIeYe2V90sGtl2qnOzv+eaS pb1O+UPXLav2y8DTFyJGyNr98rDQBgj3tfM9/C6drHw3q8E4b5BpJYlfc7/TY64DZJ1a fnStQsp8pbjZl81hX+3BBKw/AEtypfi+E885o06oUToWg3RT4PDH49svwn1ohUJdmhID 4nF8HalvityNWT20BFLKXBMCj5uirJPFtOJIUua7Loc7Nm4Cs6lmb6Odogpbx6CL3M/l mbXe0WPc1ccNe5G8xFvxAbj9AZQ7TrkLx5vCXJAgSXO8ZriHAtCEzo+B70Id8zz2C1qE sJVA== Received: by 10.52.36.40 with SMTP id n8mr23050715vdj.52.1353469194264; Tue, 20 Nov 2012 19:39:54 -0800 (PST) Received: from bobzhangs-iMac.local ([66.250.143.158]) by mx.google.com with ESMTPS id bt6sm1737601vdb.8.2012.11.20.19.39.52 (version=SSLv3 cipher=OTHER); Tue, 20 Nov 2012 19:39:53 -0800 (PST) Message-ID: <50AC4D07.2090504@gmail.com> Date: Tue, 20 Nov 2012 22:39:51 -0500 From: bobzhang User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 Newsgroups: gmane.comp.lang.caml.inria To: Wojciech Meyer CC: Francois Berenger , caml-list@inria.fr References: <50AC44E6.1070702@riken.jp> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Caml-list] Re: How to add a hook to Stream.junk? On 11/20/12 10:34 PM, Wojciech Meyer wrote: > Francois Berenger writes: > >> Why the need for module type of and all? >> >> Why not simply: >> >> module MyStream = struct >> include Stream >> let junk = >> failwith "put your code here" >> end;; > > Yes you could also do through a functor application. > > module MyStream(H : sig val junk_hook : unit -> unit end) = > struct > include Stream > let junk stream = > H.junk_hook (); > junk stream > end neither works. functor approach, as I pointed out, stream specialized on char. overshadowing junk does not work a. it's not late binding, existing definitions will not be shadowed b. type does not check... > > > -- > Wojciech Meyer > http://danmey.org >