Bug 19472 – Allow transitive module attributes (UDAs)

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-12-10T11:55:57Z
Last change time
2024-12-13T19:01:35Z
Assigned to
No Owner
Creator
Radu Racariu
See also
https://issues.dlang.org/show_bug.cgi?id=7616
Moved to GitHub: dmd#17888 →

Comments

Comment #0 by radu.racariu — 2018-12-10T11:55:57Z
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 by b2.temp — 2018-12-10T12:01:04Z
yes but no restrictions ? @trusted module stuff; <plenty of unsafe stuff here> __EOF__
Comment #2 by radu.racariu — 2018-12-10T12:13:16Z
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 by radu.racariu — 2018-12-11T15:42:55Z
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 by robert.schadek — 2024-12-13T19:01:35Z
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