Pure functions in D

Brian Palmer d at brian.codekitchen.net
Mon Sep 22 09:03:59 PDT 2008


Sergey Gromov Wrote:

> bearophile <bearophileHUGS at lycos.com> wrote:
> > > Since this wasn't touched on in the article, I want to point out
> > > that Haskell allows "pure functions" to throw exceptions, but not
> > > catch them.
> > 
> > This is quite interesting and it has some consequences. So a pure
> > function can call another pure function only if the second one can't
> > throw?
> 
> I cannot see how this follows.  If a function calls another function 
> that may throw, it doesn't automatically make it catch.  So the call may 
> be of any depth, and an exception may be thrown at any level.  You just 
> not allowed to try/catch, nor various forms of scope.

Yes, Sergey has it right here.



More information about the Digitalmars-d mailing list