caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Don Syme <dsyme@microsoft.com>
To: "'Pierre Weis'" <Pierre.Weis@inria.fr>, John.Harrison@cl.cam.ac.uk
Cc: caml-list@inria.fr
Subject: RE: Functional composition operator?
Date: Wed, 9 Dec 1998 04:00:39 -0800	[thread overview]
Message-ID: <39ADCF833E74D111A2D700805F1951EF0B2EF6B8@RED-MSG-06> (raw)


> Anyway, if you can manage the additional complexity, there is no
> problem at using a highly ``composing'' style in Caml. However, in my
> mind, it is not a good idea to promote this style, especially for the
> working programmer.

I think it simply depends on what you're doing: highly symbolic work like
theorem proving certainly benefits from a compositional style, but for
anything involving complex state control (interfaces, objects, networking,
i/o, whatever) it is not so appealing.  I think the latter tasks are what
Pierre means by "the working programmer" -- (a rather loaded term in the ML
world? ;-) )

> Let alone the case when
> these expressions involve side-effects: then, if you still insist at
> composing them on the fly, you get an order of evaluation dependant
> program and this must be carefully avoided.

Some invisible uses of side effects are highly compatible with a functional
style, e.g. memoizing and building tables based on an environment, and
certainly John uses these effectively in his programs.  Externally visible
effects are, of course, to be avoided when using a compositional approach,
as Pierre suggests.

So you're both right, and that's just why CaML is so appealing: when doing
structural data manipulations it supports the functional model, but it also
supports state-based programming in a very traditional fashion (mutable
record fields, objects, arrays, for-loops, while-loops, begin-end statements
all being part of this).  For example, I would teach both styles as part of
a CaML programming course, and I frequently use both styles in different
modules of the one program.

Don




             reply	other threads:[~1998-12-09 14:40 UTC|newest]

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

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=39ADCF833E74D111A2D700805F1951EF0B2EF6B8@RED-MSG-06 \
    --to=dsyme@microsoft.com \
    --cc=John.Harrison@cl.cam.ac.uk \
    --cc=Pierre.Weis@inria.fr \
    --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).