Embarrassed to ask this question because it seems so trivial but genuinely curious...

Dennis dkorpel at gmail.com
Thu Jan 27 18:02:40 UTC 2022


On Thursday, 27 January 2022 at 17:42:09 UTC, WhatMeWorry wrote:
> So I guess my question is, is this just a matter of esthetics 
> or is some more nuanced goal at work here?

It doesn't matter much for constructors, but in general, the 
problem with placing qualifiers in front is that it looks 
confusing:
```D
struct S
{
     immutable int[] f()
     {
         return [];
     }
}
```

This reads as if it returns an `immutable(int[])`, but it 
doesn't, the `immutable` means that it can only be called on 
`immutable` instances of `S`.




More information about the Digitalmars-d-learn mailing list