Bug 16020 – Allow AliasDeclarationY to express function types
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-05-12T10:40:15Z
Last change time
2019-05-17T12:41:06Z
Keywords
pull
Assigned to
No Owner
Creator
Basile-z
Comments
Comment #0 by b2.temp — 2016-05-12T10:40:15Z
std.typecons contains a load of C-ish alias declarations in the unittests.
The problem here is the new syntax that doesn't allow to declare the equivalent without typing a silly declaration:
for example in typecons:
alias int F1();
the only way to get the same type alias using the most modern syntax is
import std.traits;
alias F1 = PointerTarget!(int function());
and
alias F1 = int();
is not allowed at all.
There's a **gap** because now we can't say "let's drop the old alias syntax completly".
Comment #1 by dlang-bot — 2019-04-21T14:06:06Z
@Basile-z created dlang/dmd pull request #9667 "fix issue 16020 - Allow AliasDeclarationY to express function types" fixing this issue:
- fix issue 16020 - Allow AliasDeclarationY to express function types
The (not so) new alias declaration, using the assignment operator, is preferred over the old C-style declarations.
However they didn't allow to express function types, which lead to blend the declaration styles.
This change adds a new rule to `AliasDeclarationY` to solve the problem,
```diff
AliasDeclarationY:
+ 'alias' Identifier '=' BasicType '(' Parameters ')' Attributes?
```
consolidating the language consistency.
https://github.com/dlang/dmd/pull/9667
Comment #2 by dlang-bot — 2019-05-17T12:41:06Z
dlang/dmd pull request #9667 "Grammar change - Allow AliasDeclarationY to express function types" was merged into master:
- 527f213573a50896b7b5c85d3a7bc284b520270a by Basile Burg:
fix issue 16020 - Allow AliasDeclarationY to express function types
https://github.com/dlang/dmd/pull/9667