Full closures for D

David B. Held dheld at codelogicconsulting.com
Mon Nov 5 21:28:28 PST 2007


0ffh wrote:
> Bruce Adams wrote:
>> KlausO Wrote:
>> Someone with more a functional programming background may be able to
>> enlighten us but doesn't the existence of proper closures allow us to
>> implement monads as a library now? Though I can't quite see in what
>> situation we would want to use them.
> 
> Yup, IIRC the poor strictly functional guys needs them for I/O, but as
> we're imperative anyway I don't see any applications for monads either.

You might like to use monads in a "pure multithreading" environment 
where the threads are written in pure functional style and are thus 
safely lock-free.  A monad essentially allows you to defer any necessary 
locking to a convenient place and time.

Dave



More information about the Digitalmars-d mailing list