caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Brian Rogoff <bpr@best.com>
To: David McClain <dmcclain1@mindspring.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Evaluation Order
Date: Sat, 9 Jun 2001 13:17:34 -0700 (PDT)	[thread overview]
Message-ID: <Pine.BSF.4.21.0106091229550.7577-100000@shell5.ba.best.com> (raw)
In-Reply-To: <000701c0f0fd$32c88c90$210148bf@dylan>

On Sat, 9 Jun 2001, David McClain wrote:
> I thought I would share an experience with all of you to solicit your
> *constructive* comments.

Hmmm, last time we were through this I recall that you were emphatically
in favor of leaving the evaluation order undefined. It is good that you
have finally seen the light ;-) (sorry, that wasn't terribly constructive). 

> I had forgotten about the evaluation ordering in OCaml being from right to
> left. 

Actually, if you are an anal reader of reference manuals (sorry, once an
Ada programmer...) you'll not that evaluation order in OCaml is currently 
unspecified. Of course, the one implementation behaves as you describe.

> I suppose if Hebrew or Arabic were my native tongue then the opposite
> expectation would be true and I would have naturally written
> 
>     let ans = fny() + fnx()
> 
> and I would be no wiser about evaluation order here, since everything would
> have worked properly.

No, if Hebrew or Arabic were your native tongue you'd have exactly the
same expectation as you have now, which is that the events occur in the
order that you scan them while reading. What happens in OCaml now is like
some weird boustrophedon.

> I had been lulled into a belief that OCaml was nearly perfect, while C/C++
> is definitely not. 

But that's true! Damn, I keep baiting Chris, gotta sit on my hands :-)

> The problem is not one of OCaml, but rather a clash between normal
> psychological expectations and the programming language at hand.

No, this is a language problem. Lots of people who teach OCaml have mentioned 
that this is an issue. If the clash with expectation is so great then that
You should always be careful about sequencing in imperative style programming, 
but IMO this is one of those few things that SML does right that OCaml does 
not. As you say, there is a very strong expectation that events occur in
the order that we read them. The original arguments about optimizations
and parallelism don't seem to have borne fruit, so it would be good to fix
this.

> Any thoughts? (other than that I was boneheaded here!)

Use lots of lets to sequence operations. Avoid side effects like output in
value returning operations, otherwise you'll want to use lets to sequence
the outputs while getting the value. Write Haskellish code, by which I
mean try to push all of your refs and mutable values to the top level and
have all of your library calls pure. Agitate to get this annoying feature
fixed. Etc...

-- Brian


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  reply	other threads:[~2001-06-09 20:17 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-09 15:59 David McClain
2001-06-09 20:17 ` Brian Rogoff [this message]
2001-06-09 23:12   ` David McClain
2001-06-09 23:28     ` David McClain
2001-06-10  1:04       ` Dave Mason
2001-06-10  2:25         ` David McClain
2001-06-11 13:03           ` Dave Mason
2001-06-12 17:55             ` John Max Skaller
2001-06-13 16:54               ` Frederick Smith
2001-06-13 21:43                 ` John Max Skaller
2001-06-10  1:06       ` Charles Martin
2001-06-10  2:27         ` David McClain
2001-06-10 11:18         ` Tore Lund
2001-06-10 13:11           ` Tore Lund
2001-06-10 14:31           ` John Max Skaller
2001-06-12 15:12             ` Pierre Weis
2001-06-10 10:40       ` Joerg Czeranski
2001-06-10 14:06       ` John Max Skaller
2001-06-11 12:59         ` Dave Mason
2001-06-12 17:34           ` John Max Skaller
2001-06-10 13:47   ` John Max Skaller
2001-06-10 16:47     ` Brian Rogoff
2001-06-10 17:27       ` Dave Mason
2001-06-12 16:10       ` John Max Skaller
2001-06-09 23:19 ` John Max Skaller
2001-06-10  2:44 David McClain
2001-06-10  2:48 ` Patrick M Doane
2001-06-10  5:51   ` David McClain
2001-06-10 17:59 Damien Doligez
2001-06-10 18:28 ` Dave Mason
2001-06-15 17:00 Manuel Fahndrich
2009-06-14 16:36 evaluation order Christophe Raffalli
2009-06-14 19:40 ` [Caml-list] " Jon Harrop
2009-06-14 21:12   ` Christophe Raffalli

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=Pine.BSF.4.21.0106091229550.7577-100000@shell5.ba.best.com \
    --to=bpr@best.com \
    --cc=caml-list@inria.fr \
    --cc=dmcclain1@mindspring.com \
    /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).