Comment #0 by stanislav.blinov — 2020-06-17T23:03:02Z
alias refInt = ref int; // compiles
alias outInt = out int; // does not
Neither should.
Comment #1 by boris2.9 — 2020-06-18T04:58:47Z
There's one usage of this in Phobos even though it doesn't work.
std/range/package.d
----------------------------
// This doesn't work yet
static if (allSameType)
{
alias ElementType = ref RvalueElementType;
}
else
{
----------------------------
Comment #2 by stanislav.blinov — 2020-06-18T10:10:52Z
Comment #3 by stanislav.blinov — 2020-06-18T12:37:01Z
All of these compile:
alias st = static int;
alias au = auto int;
alias sc = scope int;
alias ov = override int;
alias ab = abstract int;
alias sy = synchronized int;
alias nt = nothrow int;
alias pu = pure int;
alias re = ref int;
And none of them should, ideally with a message such as:
`ref` is not allowed in `alias` declaration.
(Currently, `out` and `lazy` don't compile, but the message is not that succinct, as it falls through multiple parsing attemts).
Comment #4 by stanislav.blinov — 2020-06-18T13:53:25Z
...and then there's the whole old syntax of
alias static int si;
alias auto int au;
alias scope int sc;
alias override int ov;
alias abstract int ab;
alias synchronized int sy;
alias nothrow int nt;
alias pure int pu;
alias ref int re;
alias __gshared int gs;
Comment #5 by robert.schadek — 2024-12-13T19:09:19Z