Voldemort declarations inside structs with ctor initialization

Meta via Digitalmars-d digitalmars-d at puremagic.com
Tue May 27 19:05:40 PDT 2014


On Tuesday, 27 May 2014 at 23:18:12 UTC, Idan Arye wrote:
> Well, it won't work for the example that opened this 
> thread(converted to use lambdas).
>
> As for limiting the delegate version to ones that use @pure and 
> @nogc, take another look at my example. The lambdas don't 
> allocate anything so they're obviously @nogc. As for @pure, 
> they doesn't have any side effects, and depend only on their 
> arguments(they don't have arguments, and they are constant 
> functions) and their scope(which happens to be mutable, but you 
> could easily make it immutable and nothing will change).

Delegates by default allocate a closure. If they're marked @nogc, 
they'd be unable to allocate that closure... I think. The pure 
annotation is to stop them from accessing global mutable state.


More information about the Digitalmars-d mailing list