On Tue, 26 Jun 2012 14:08:14 -0400, Benjamin Thaut
<[email protected]> wrote:
Thanks this works, but it seems to be a very ugly hack just to work
around the type system. Also I have templated allocator functions I can
not use this trick on. This is going to be a lot of work to get done
properly, so I just ignore pure for now I think.
Um... yeah :) If you are working around the type system, it *should* be
ugly!
Note that you should be *extremely* careful of saying something is pure
when it is not typechecked by the compiler. If I were designing such an
allocator system, I'd separate out pure and impure allocators into two
separate hierarchies, and let the person implementing the actual
underlying allocator jump the fence between pure and impure.
For example, in the code I gave, really only C malloc should be
forced-pure, everything else should be typechecked as pure by the
compiler. But you were asking for a specific solution.
-Steve