[Dlang-study] [lifetime] Local garbage collector for pure functions
Marc Schütz
schuetzm at gmx.net
Fri Dec 25 07:33:27 PST 2015
This is a very nice idea. Note that LDC already transforms
certain GC allocations into stack allocations, but only as an
optimization. There need to be fixed rules about which kinds of
allocations are guaranteed to be moved to the stack or a
dedicated region allocator.
By the way, you seem to have in mind a special function
attribute, but this isn't necessary. In fact, apart from making
the function @nogc, how it allocates is memory is purely an
implementation detail. Your suggestions therefore don't require
(formal) purity or any special attribute in the function
signature.
More information about the Dlang-study
mailing list