Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Evaluation Order
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dave Mason <dmason@s...>
Subject: Re: [Caml-list] Evaluation Order
>>>>> On Sun, 10 Jun 2001 09:47:25 -0700 (PDT), Brian Rogoff <bpr@best.com> said:

> Well, OCaml isn't referentially transparent, and it is strict to
> begin with. I agree that it would be awful if my argument was only
> about the order of evaluation of (+).

No it isn't.  But it would be nice if code which wasn't was detectable
as such and otherwise you could reason as if it were.  I have a
longish email on its way to the list that proposes marking the results
of any functions that cause side-effects as such, and not allowing
them to be used in compound expressions where they would be
order-dependent.

> Why not make the default correspond to everyone's intuition?

Because that isn't everyone's intuition!  Better to not specify the
order, but prevent expressions where order dependency could create a
problem.  That also leaves the compiler maximum flexibility in
ordering evaluation (while this may not be exploited by the current
compilers, it is likely to become increasingly important as the
processor/memory differential increases).

> I agree completely. I even shove in prints to debug purely
> functional code (shame on me!) by adding "let _ = prerr_endline
> ... in" in such constructs.

I sometimes do that.  Perhaps for my proposal it would be useful to
have a ``debugf'' that prints (and flushes) to stderr, but isn't
flagged as side-effecting, with the assumption that these are not part
of the semantics of the program and will be removed before production.

(BTW, my postings to this list usually take 2 days to appear... I just
checked and this machine's mail queue is empty, so I don't know which
machine is holding on to my posting.... but I wish it would stop!)

../Dave
-------------------
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