[challenge] Limitation in D's metaprogramming

bearophile bearophileHUGS at lycos.com
Mon Oct 18 18:49:41 PDT 2010


Jonathan M Davis:

> You can think of a monad as an extra parameter which is passed to each function 
> and holds the global state. It isn't a hole in purity at all. For instance, it's 
> how Haskell manages to have I/O and yet be functionally pure. You don't need the 
> compiler's help to do monads - it's just easier if you have it.

Yet, sooner or later the compiler has to help you giving you a hole to let the contents of those I/O monads pass though to/from the outside world, otherwise you will not see any program input/output unless you use something like a post-mortem debugger :-) So I think the Haskell compiler has to manage your I/O monads in a special way anyway. Purity can't be absolute.

Bye,
bearophile


More information about the Digitalmars-d mailing list