D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19472 - Allow transitive module attributes (UDAs)
Summary: Allow transitive module attributes (UDAs)
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-10 11:55 UTC by RR
Modified: 2024-12-13 19:01 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description RR 2018-12-10 11:55:57 UTC
When developing @safe @nogc nothrow code, the mantra needs repeated on each module and each aggregate in the module. This is verbose and has little value for the reader, more noise in the code.

Currently adding module level attributes is not allowed:
---
@nogc module foo;
---
Error: @nogc attribute for module declaration is not supported

Would be nice to able to annotate whole modules (including aggregates inside the module) with a set of attributes - this will reduce the clutter and actually be useful as a documentation for readers.
Comment 1 basile-z 2018-12-10 12:01:04 UTC
yes but no restrictions ?

@trusted module stuff;

<plenty of unsafe stuff here>

__EOF__
Comment 2 RR 2018-12-10 12:13:16 UTC
You can do this ATM with global declarations

---
@trusted:
---

or on aggregates

---
@trusted struct Foo
---

so there is no change on how you can shot yourself in the proverbial foot.
Comment 3 RR 2018-12-11 15:42:55 UTC
This https://atilanevesoncode.wordpress.com/2018/12/11/what-d-got-wrong/ points out the "attribute soup" issue, which could be ameliorated by this feature request. One can simply group similar concerning code with certain attributes in modules and thus greatly reduce the number of attribute declarations inside modules and module members.
Comment 4 dlangBugzillaToGithub 2024-12-13 19:01:35 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/17888

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB