Help needed: immutable struct is a type modifier, and that's wrong and broken

Timon Gehr timon.gehr at gmx.ch
Thu Apr 16 04:28:35 UTC 2020


On 16.04.20 05:55, RazvanN wrote:
> 
> 
> Additionally, I think that
> 
> static if(is(S == immutable T, T))
> 
> should also not pass.
> 
> The correct form should be
> 
> static if(is(S == immutable))
> 
> This way you express the fact that S is an immutably defined type (with 
> a storage specifier), whereas in the first case you test if S is an 
> immutably declared type (with a type constructor).

So the proposal is to turn `is` into an even more convoluted mess? :)

Why should it even be possible to test for `immutable` on the 
declaration? That seems like an implementation detail as the only thing 
it achieves is that all members are marked that way.


More information about the Digitalmars-d mailing list