July 06, 2023
https://issues.dlang.org/show_bug.cgi?id=24033

          Issue ID: 24033
           Summary: [compiler diagnostics] Add a way to make aliases
                    "strong"
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: qs.il.paperinik@gmail.com

This is not about language semantics, but compiler diagnostics only.

Aliases are weak in the sense that error messages resolve aliases:
```d
alias ints = int[];
void f(ints xs);
pragma(msg, typeof(&f)); // void function(int[] xs)
```

The only exceptions are `string`, `wstring`, and `dstring`:
```d
void f(immutable(char)[] str);
pragma(msg, typeof(&f)); // void function(string str)
```

The string aliases aren’t like regular aliases: Their alias name is displayed instead of the type they alias.

It might be of great pleasure to users if any alias could be marked "strong" by the programmer, so that the alias appears in diagnostics and not the aliased type.

Of course, for each type, there must not be multiple different "strong" aliases.

---

There are several possibilities:
* re-use the `typedef` keyword: `typedef ints = int[];`
* introduce an @attribute: `@strong alias ints = int[];` (applicable to `alias`
only)
* introduce a pragma: `pragma(strong) alias ints = int[];` (applicable to
`alias` only)
* introduce a trait: `__traits(strong) alias ints = int[]; (applicable to
`alias` only)

This is especially useful for templates with optional parameters where users are generally not interested in the defaults.

--