Declaration registration #1050
dabrahams
started this conversation in
Language design
Replies: 1 comment
-
Would be pretty useful to have an ability to add arbitrary associated tags to declarations. Go calls them "struct tags". Java - annotations. C# - attributes. Swift doesn't have them, but to some extent they could be mimicked by property wrappers and macros.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There's a pattern that comes up, e.g. in test and serialization frameworks, that I don't think we currently have a good answer for. Basically, it generalizes to this: declaring certain kinds of things causes those things to be "registered" somehow into a dynamically traversable data structure. One example from Swift is
XCTestCase
. In languages with mutable globals this might translate into simply ensuring that certain code isn't dead-stripped, but we'd need to build these data structures at module load time or something.There's no hurry to come up with this feature, but I wanted to create a marker for it.
Beta Was this translation helpful? Give feedback.
All reactions