Is this function pure?

Nathan Reed nathaniel.reed at gmail.com
Tue Sep 18 18:11:57 PDT 2007


Bruce Adams wrote:
> My understanding is that pure is a compile time concept. If your function can violate it its not pure, unless you have a scheme for compile time exception handling - yeauch.

Pure functions aren't necessarily /evaluated/ at compile time.  They can 
throw exceptions when evaluated at run-time, just like any function.

However, even for functions evaluated at compile time I can't see that 
throwing and catching exceptions would be that big a deal.  CTFE is 
basically like running an interpreter, right?

Thanks,
Nathan Reed



More information about the Digitalmars-d mailing list