DDC compiler and effects; better than Haskell? (was Re: [Haskell-cafe] unsafeDestructiveAssign?)

Ben Lippmeier Ben.Lippmeier at anu.edu.au
Wed Aug 12 23:11:09 EDT 2009


Derek Elkins wrote:
>> The compiler is supposed to be able to reorder non-strict
>> evaluation to do optimisations, but that can't be done if effects
>> could happen.
>>     
>
> There's nothing special about non-strict evaluation that makes the
> antecedent true.  Replacing "non-strict" with "strict" gives just as
> much of a valid statement.  It is purity that allows (some) reordering
> of evaluation.
>   
Here are two effectful statements that can safely be reordered.

  print "foo"
  x := 5


here are two more

  y := 2
  z := 3

(provided y and z don't alias)


Purity allows some reordering of evaluation, so does knowing that
two effectful computations won't interfere.


Ben.





More information about the Haskell-Cafe mailing list