On Tuesday, 11 April 2017 at 09:53:46 UTC, Martin Nowak wrote:
I think we might be able to solve this problem in D by making IAllocator.allocate pure, which tells the compiler that this function returns a fresh piece of memory without any side-effect, i.e. enough information to optimize away allocations.

Pure might be too restrictive for some allocators, but maybe this can be solved with a little type system hack (or at worse a compiler exemption).

In LDC we have an attribute for that `allocSize` (https://github.com/ldc-developers/druntime/blob/ldc/src/ldc/attributes.d#L16)

perhaps this attribute should be used across compilers and be in druntime?

Reply via email to