Pure functions in D

BCS ao at pathlink.com
Sun Sep 28 14:04:03 PDT 2008


Reply to Jason,

> You're missing the subtleties in what Walter said:
> "If memory allocation failure is a non-recoverable exception,
> then pure functions can allocate memory."
> That means that if an out of memory exception occurs, the pure
> function (possibly even the whole program) can not catch the out of
> memory exception.  Either a pure function will operate normally and
> predictably, or it has a non-recoverable error.  This has to be
> handled differently than recoverable errors/exceptions which are
> predictable/repeatable.
> 


Ditto. To argue the point by taking it to the ridiculous: *Any* function 
can fail for any number of reasons that aren't related the to arguments; 
stack overflows, un-handled external signals (SIGKILL), loss of power to 
the the CPU, arbitrary hardware failure. The line has to be drawn somewhere, 
the question is only where.





More information about the Digitalmars-d mailing list