Immutable Structs and std.concurrency

Timon Gehr timon.gehr at gmx.ch
Thu Apr 19 15:16:24 PDT 2012


On 04/19/2012 11:55 PM, Jakob Ovrum wrote:
> On Thursday, 19 April 2012 at 21:33:46 UTC, Timon Gehr wrote:
>> Unfortunately the patch is incomplete. (template parameter matching is
>> not implemented afaik and it does not work for structs)
>
> Ah, didn't know about the template blocker, but how should it work for
> structs? Shouldn't the syntax only be allowed for implicit reference
> types, i.e. classes only?

std.typecons.Rebindable works for immutable structs with indirections.

Reference types are just value types with indirections anyway:

struct Object{
     ObjectInstance* storage;
     alias storage this;
}

The language should catch this case even for user-defined types imo.


More information about the Digitalmars-d-learn mailing list