DDC compiler and effects;
better than Haskell? (was Re: [Haskell-cafe] unsafeDestructiveAssign?)
John A. De Goes
john at n-brain.net
Sat Aug 15 19:18:05 EDT 2009
On Aug 15, 2009, at 4:59 PM, Sebastian Sylvan wrote:
> Your point about safety in C has no relation to safety in a
> functional language with a sophisticated effect system.
> I'm sorry, but I think it does. You're advocating that modifications
> to mutable state shouldn't have sequential semantics,
You must think I'm arguing for some kind of low-level analog of C,
augmented with an effect system. I'm not. You can't do that.
To maximize the potential for optimization, you need a high-level
language, mostly functional, with a very sophisticated and carefully
controlled effects system for expressing imperative actions.
If you have threads and shared mutable state, then you might require
that any access to shared state be done through an atomic block (STM).
The type system would encode if mutable variables can be shared
between threads, and if so, the compiler would mandate they be
accessed from inside an atomic block.
In such conditions, multiple sequential writes can be safely
parallelized, in addition to a host of other optimizations.
> I'm pointing out that this is the case today in C on many CPUs and
> it's a royal pain to work with in practice (causing many almost-
> impossible-to-debug crashes). I would not want functional languages
> to adopt something that's proven to be insanity-inducingly difficult
> to use.
Please don't ever bring up C again. You can't do anything interesting
John A. De Goes
The Evolution of Collaboration
http://www.n-brain.net | 877-376-2724 x 101
More information about the Haskell-Cafe