Pure functions in D
Russell Lewis
webmaster at villagersonline.com
Mon Sep 29 09:09:44 PDT 2008
Walter Bright wrote:
> Bruno Medeiros wrote:
>> Will memory allocation be considered pure?
>
> I don't know yet. If memory allocation failure is a non-recoverable
> exception, then pure functions can allocate memory.
Another option is for pure functions to use a blocking, never-fail
allocator. That is, when a pure function allocates and we don't have
enough memory, then instead of returning an out-of-memory exception,
that thread will block until memory is freed.
Of course, that would mean deadlock if we only had one thread, or if all
threads blocked in this same situation, so we might want to have "kill
the application" code to handle that case.
More information about the Digitalmars-d
mailing list