Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-08-03 (05:13)
From: skaller <skaller@u...>
Subject: strict?
I'm looking for a pair of concepts such as

nice function/transparent expression

which allow an arbitrary choice of evaluation strategy.

A nice function is basically one like 'sin' which is
total, has no side effects, depends only on its arguments,
and always returns a value. I think this is basically
'total, pure and strict'.

A transparent expression is one which can be evaluated
at any time, anywhere. For example 'sin 1.0' is the same
no matter when and where it is evaluated. More or less
an expression is transparent if it is a constant or
application of nice functions to transparent arguments.

The idea is basically to know when a compiler can choose
the evaluation strategy based on performance, without
worrying that this will change semantics. More precisely
my translator *already* does this .. and I want to know
when this is justified (so I can figure out how to
give the programmer enough annotations and control
to get the result they want, and be able to reason
about their code).

Note I use the word 'function' in the C (or Ocaml) sense here.
Clearly the Wikipedia definition of strict:

	f(bottom) = bottom

is rubbish when applied to a mathematical function like 'sin', 
since bottom isn't a valid argument, but it makes sense
for 'sin' in the programming language sense.

John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: