From: "David McClain" <dmcclain1@mindspring.com>
To: <caml-list@inria.fr>
Subject: Re: [Caml-list] Evaluation Order
Date: Sat, 9 Jun 2001 16:28:56 -0700 [thread overview]
Message-ID: <000901c0f13b$f981c610$210148bf@dylan> (raw)
In-Reply-To: <001501c0f139$9ce86640$210148bf@dylan>
> > 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...
>
> Actually the side effects I was referring to have nothing to do with
> reference vars. In fact there are none in the code. Rather, the side
effects
> have to do with the order in which data are processed and sent along to
the
> next job upstream.
In fact let me be a bit more specific, by way of example...
The block convolution operation could be viewed as adding reverberation to a
data stream. The first function processes the entire stream. The second
operation writes out the remainder, the reverb tail, after the input stream
has been exhausted.
My mistake was writing
let ans = process_stream() + process_tail()
where both operations return a count of how many data samples had been
written to the output stream. I accidentally got the tail processing first,
which caused the anomalous output. The front of the output stream had too
much null data, and the final tail of the stream was chopped off.
The results of these two operations, integers, are arithmetically commutable
under addition. But what isn't commutable is the order in which these
operations occur. No current type checking in OCaml (or any other language
with which I am familiar) could help catch this mistake.
What is needed is some specification that indicates temporal preference, and
then the type checking mechanism must be enhanced to keep temporal order.
Most programs in OCaml probably have no preference, and in fact, a sense of
order is strongly discouraged in most FPL's -- e.g., Haskell.
I am saying that real-world applications for control systems do have strong
needs for these additional constraints. I am not being critical of OCaml or
any other language here. But my experience pointed out the need for even
more from programming languages than what we have today.
The major flubs of the past decades, Arianne, Therac, and many others, are
examples of systems in which not only the data types have to be ensured, but
also temporal orderings of function evaluation. We are rapidly adopting a
system with a foundation of dust when we come to rely so heavily on human
programmed computers to manage and treat our lives.
- DM
----- Original Message -----
From: "David McClain" <dmcclain1@mindspring.com>
To: "Brian Rogoff" <bpr@best.com>
Cc: <caml-list@inria.fr>
Sent: Saturday, June 09, 2001 4:12 PM
Subject: Re: [Caml-list] Evaluation Order
> > 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.
>
> Huh? Hebrew and Arabic read from right to left, which is why I said what I
> did... A boustrophedon infers that the order changes to and fro in a
raster
> pattern. I won't argue the point about unspecified order of evaluation. I
> would argue for notation that indicates temporal preferences and helps to
> enforce them in the code.
>
>
> > 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...
>
> Actually the side effects I was referring to have nothing to do with
> reference vars. In fact there are none in the code. Rather, the side
effects
> have to do with the order in which data are processed and sent along to
the
> next job upstream.
>
> I would argue for something stronger here. The mistake was made as a
result
> of performing a commutative arithmetic operation between two results that
> should never commute in time. I think a sequencing operation and a type
that
> distinguishes objects that have specified temporal orderings is in order
> here.
>
> Otherwise we are left to astute programmers who have to be on their very
> guard continuously against unintentional misuse of evaluation order.
Humans
> are not trustworthy in the sense that machines are, which never tire of
> mundane tasks.
>
> - DM
>
> -------------------
> 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
-------------------
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
next prev parent reply other threads:[~2001-06-09 23:26 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
2001-06-09 23:12 ` David McClain
2001-06-09 23:28 ` David McClain [this message]
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='000901c0f13b$f981c610$210148bf@dylan' \
--to=dmcclain1@mindspring.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