caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Chet Murthy <chet@watson.ibm.com>
To: Julian Assange <proff@iq.org>
Cc: Chet Murthy <chet@watson.ibm.com>, Dave Berry <dave@kal.com>,
	STARYNKEVITCH Basile <Basile.Starynkevitch@cea.fr>,
	caml-list@inria.fr
Subject: Re: callcc/cps-style programming
Date: Fri, 15 Dec 2000 18:10:35 -0500	[thread overview]
Message-ID: <200012152310.SAA13137@bismarck-chet.watson.ibm.com> (raw)
In-Reply-To: Your message of "16 Dec 2000 05:37:56 +1100." <wxd7etediz.fsf@suburbia.net>


>>>>> "JA" == Julian Assange <proff@iq.org> writes:

    JA> Chet Murthy <chet@watson.ibm.com> writes:

    >> Stuff like:
    >> 
    >> (i) allocating memory in the middle of a finalizer -- e.g., a
    >> finalizer which is pushing some reusable resource onto some
    >> stack (and the stack needs to be grown)
    >> 
    >> (ii) locking some object in a finalizer, which can also be
    >> locked by some thread that which would allocate memory with
    >> that lock held.
    >> 
    >> (iii) SMP-unsafe code galore -- race conditions,
    >> memory-incoherence, thrash-prone code.

    JA> If code is written in a functional manner, almost all of these
    JA> problems disappear. This is why functional languages and
    JA> concurrency dovetail so nicely together. Further, in some
    JA> cases you can use concurrency to hide state changes; allowing
    JA> one to write functional code where previously it was unatural
    JA> to do so.

The sorts of code I described cannot be written functionally.  It
talks to the outside world, or pools resources (and no, the GC isn't
perfect, so you _do_ have to pool resoruces from time to time), or
does any of a number of other things that make it necessary to use
shared variables.

I'm an old ML programmer.  I've written lots and lots of ML code
(including what I believe was the first thread-safe SUNRPC stack -- in
SML/NJ).  But quite simply, there are things that can only be done in
a imperative manner.  Or that can only be done with shared variables.

--chet--



  reply	other threads:[~2000-12-18 14:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-13 13:44 Dave Berry
2000-12-13 16:36 ` Chet Murthy
2000-12-14 19:20   ` T. Kurt Bond
2000-12-15 13:31     ` Martin Berger
2000-12-15 18:37   ` Julian Assange
2000-12-15 23:10     ` Chet Murthy [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-12-14 19:08 forsyth
2000-12-06 20:13 Joe Lisp
2000-12-07  8:31 ` STARYNKEVITCH Basile
2000-12-09  3:58   ` eijiro_sumii
2000-12-09 18:48   ` Chet Murthy
2000-12-12 17:14     ` John Max Skaller
2000-12-08 10:50 ` Xavier Leroy

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=200012152310.SAA13137@bismarck-chet.watson.ibm.com \
    --to=chet@watson.ibm.com \
    --cc=Basile.Starynkevitch@cea.fr \
    --cc=caml-list@inria.fr \
    --cc=dave@kal.com \
    --cc=proff@iq.org \
    /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).