constructing module level immutable variables at runtime?

Danni Coy via Digitalmars-d digitalmars-d at puremagic.com
Sun Feb 21 23:27:02 PST 2016


On Mon, Feb 22, 2016 at 5:09 PM, Sönke Ludwig
<digitalmars-d at puremagic.com> wrote:
>
> This actually works already, if you use "shared static this". "static this"
> is invoked for each thread that is started, thus it would overwrite the
> existing value of num_triggers, potentially multiple times.

module config;

shared static this ()
{
    num_triggers = 1024;
}

private:
immutable(int) num_triggers = void;

is not working for me with dmd 2.070



More information about the Digitalmars-d mailing list