Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Brian Rogoff <bpr@best.com>
To: caml-list@inria.fr
Subject: Re: Undefined evaluation order
Date: Tue, 10 Oct 2000 13:52:33 -0700 (PDT)	[thread overview]
Message-ID: <Pine.BSF.4.21.0010101321420.24594-100000@shell5.ba.best.com> (raw)
In-Reply-To: <14819.4066.697232.891781@heplix4.ikp.physik.tu-darmstadt.de>

On Tue, 10 Oct 2000, Thorsten Ohl wrote:
> Maybe I have ben brainwashed by too much Fortran, but depending on
> side effects in the evaluation of function arguments that change the
> result according to the evaluation order is not good style, IMHO.

I suppose I could claim to be brainwashed by too much Ada and C as well,
but somehow I am no longer enthralled by the lack of specified evaluation
order in those languages, even though I like both of them (not as much as 
OCaml of course :-).

BTW, in the particular case I mentioned, it wasn't function arguments but 
record/tuple expressions, as I was building an structure from a file read. 
It doesn't seem like bad style at all, in fact it seemed quite natural, 
only it doesn't work in OCaml, but would be fine SML.

> Explicit `let' bindings are clear and improve the likelihood that the
> author will still be able to understand his/her code a few year later
> significantly.

I don't believe that it improves understandability. Fix the evaluation
order to be left-to-right and the code is more understandable IMO. 
Explicitness doesn't necessarily imply greater readability/understandability.

Obviously, clarity is in the eye of the beholder, and probably depends on
your experiences as a programmer. I find the explicit let for sequencing 
redundant and distracting. Of course, if evaluation order were defined to 
be right-to-left I would use let bindings to force left-to-right because 
r-t-l is SO unnatural. 

> I agree that leaving this important chunk of the semantics unspecified
> is not nice, but closing the door on parallelism forever would be much
> worse, IMHO.

Arguments about optimizations in the bytecode compiler and parallelization 
are good arguments. The question is whether these outweigh the obvious
drawbacks. I don't think specifying evaluation order closes out
parallelism forever, since you can extend the language with explicit
parallel sequencing constructs if this were to ever become important. 

> (Only half-joking) There should be an option in the compiler
> randomizing evaluation order for debugging ...

That would be a good even if we had a specified order, so that you don't
inadvertently write code with such dependencies. 

-- Brian




  reply	other threads:[~2000-10-11 19:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-05 18:14 Brian Rogoff
2000-10-06  2:02 ` Ken Wakita
2000-10-06 11:18   ` Pierpaolo BERNARDI
2000-10-07  6:46     ` Ken Wakita
2000-10-08 15:43 ` David Mentré
2000-10-08 22:47   ` Brian Rogoff
2000-10-10 12:47     ` Thorsten Ohl
2000-10-10 20:52       ` Brian Rogoff [this message]
2000-10-10 19:26     ` Stefan Monnier
2000-10-09 12:45 ` Xavier Leroy
2000-10-10 12:46 Greg Morrisett
2000-10-10 18:55 John R Harrison
2000-10-10 19:23 David McClain
2000-10-11 12:22 Greg Morrisett
2000-10-11 20:35 ` Pierre Weis
2000-10-13  7:05   ` Judicael Courant
2000-10-13 14:21     ` Markus Mottl
2000-10-16  8:38       ` Christophe Raffalli
2000-10-16 15:48         ` Brian Rogoff
2000-10-16 16:29           ` Christophe Raffalli
2000-10-17  9:19             ` Ralf Treinen
2000-10-12  9:53 Dave Berry
2000-10-12 11:32 Greg Morrisett
2000-10-12 17:06 David McClain
2000-10-13 13:56 Dave Berry
2000-10-14  1:42 David McClain
2000-10-20 14:59 Gerard Huet

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.0010101321420.24594-100000@shell5.ba.best.com \
    --to=bpr@best.com \
    --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