On 08/11/2016 06:33 PM, Mike Parker via Digitalmars-d-learn wrote:
On Friday, 12 August 2016 at 00:44:31 UTC, Charles Hixson wrote:
A way around this, which may be the same as the approach used by string was:

alias immutable(Msg_)    Msg;
class    Msg_
{  ...


This is exactly what Jonathan suggested in the post above. And yes, it's how string is handled:

alias string = immutable(char)[];


This so far appears to do what I want. The only problem is that it introduces an extraneous symbol, which I would prefer to avoid.

What problem do you want to avoid? This is a common D idiom. Alias names are very short-lived. Yes, it's another symbol in the namespace, but it will never make it to the object file. It won't even make it to error messages -- you'll see Msg_ there instead.
Yes, I saw his answer after I'd posted my resolution.
It works, it's just not the syntax that I'd prefer. And it leaves me wondering exactly what
immutable class Msg {...}
was declaring.

Reply via email to