Comment #0 by qs.il.paperinik — 2023-07-06T12:02:11Z
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.
Comment #1 by robert.schadek — 2024-12-13T19:30:03Z