caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: John Harrison <John.Harrison@cl.cam.ac.uk>
To: caml-list@inria.fr
Cc: John.Harrison@cl.cam.ac.uk
Subject: Re: Functional composition operator?
Date: Tue, 08 Dec 1998 21:52:54 +0000	[thread overview]
Message-ID: <E0znV41-00070g-00@heaton.cl.cam.ac.uk> (raw)
In-Reply-To: Your message of "Tue, 08 Dec 1998 18:02:21 +0100." <199812081702.SAA29130@pauillac.inria.fr>


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.




  reply	other threads:[~1998-12-09  9:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-08  5:23 John Whitley
1998-12-08 17:02 ` Pierre Weis
1998-12-08 21:52   ` John Harrison [this message]
1998-12-09 10:58     ` Pierre Weis
1998-12-09 17:17       ` John Harrison
1998-12-11 13:57         ` Pierre Weis
1998-12-08 18:08 Andrew Kay
1998-12-08 20:32 ` John Prevost
1998-12-09 16:17 ` Anton Moscal
1998-12-08 19:51 Don Syme
1998-12-08 20:09 Don Syme
1998-12-09 12:00 Don Syme

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E0znV41-00070g-00@heaton.cl.cam.ac.uk \
    --to=john.harrison@cl.cam.ac.uk \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).