Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow transitive module attributes (UDAs) #17888

Open
dlangBugzillaToGithub opened this issue Dec 10, 2018 · 3 comments
Open

Allow transitive module attributes (UDAs) #17888

dlangBugzillaToGithub opened this issue Dec 10, 2018 · 3 comments

Comments

@dlangBugzillaToGithub
Copy link

Radu Racariu (@rracariu) reported this on 2018-12-10T11:55:57Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=19472

Description

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.
@dlangBugzillaToGithub
Copy link
Author

b2.temp commented on 2018-12-10T12:01:04Z

yes but no restrictions ?

@trusted module stuff;

<plenty of unsafe stuff here>

__EOF__

@dlangBugzillaToGithub
Copy link
Author

radu.racariu (@rracariu) commented on 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.

@dlangBugzillaToGithub
Copy link
Author

radu.racariu (@rracariu) commented on 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant