From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA07191 for caml-redistribution; Wed, 9 Dec 1998 10:13:02 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA28126 for ; Tue, 8 Dec 1998 22:53:05 +0100 (MET) Received: from heaton.cl.cam.ac.uk (heaton.cl.cam.ac.uk [128.232.32.11]) by nez-perce.inria.fr (8.8.7/8.8.7) with SMTP id WAA13777 for ; Tue, 8 Dec 1998 22:53:04 +0100 (MET) Received: from albatross.cl.cam.ac.uk (cl.cam.ac.uk) [128.232.0.96] by heaton.cl.cam.ac.uk with esmtp (Exim 1.82 #1) id 0znV41-00070g-00; Tue, 8 Dec 1998 21:53:01 +0000 X-uri: To: caml-list@inria.fr Cc: John.Harrison@cl.cam.ac.uk Subject: Re: Functional composition operator? In-reply-to: Your message of "Tue, 08 Dec 1998 18:02:21 +0100." <199812081702.SAA29130@pauillac.inria.fr> Date: Tue, 08 Dec 1998 21:52:54 +0000 From: John Harrison Message-Id: Sender: weis Pierre Weis writes: | In fact we discourage the usage of functional composition as a general | programming tool A very bad idea, in my opinion. | -- it only save a few characters in programs | (Compare | let h = f o g | with | let h x = f (g x);;) | -- it breaks the polymorphism | (if defined as | let h = f o g | h is not generalized, since its definition is a function | application, whereas inline expansion of functional composition | let h x = f (g x) | being the definition of a function is properly generalized.) These alternatives are not semantically equivalent. If f and g are complicated expressions that can be further evaluated, it is often highly undesirable to perform the evaluation every time h is called, which is what "let h x = f(g x)" entails. John.