Closed bwoebi closed 3 years ago
We may even consider a couple native traits/primitives as part of the standard library (because it feels to me like this could be a common pattern, but if we don't do that ourselves, every library will just roll their own over and over again).
Sounds sensible. Adding an attribute there would probably just add it to the underlying case class.
The RFC as written uses a Swift-like syntax for primitives. I'm not sure that there's a good reason to do both that and attributes.
I think just propagating the attributes to the case class would make most sense.
#[FooAttribute]
enum Foo {
#[BarAttribute]
case Bar;
}
// -->
#[FooAttribute]
sealed class Foo {}
#[BarAttribute]
class Bar extends Foo {}
Quoting example from rightfold: https://chat.stackoverflow.com/transcript/message/50502258#50502258
I think that's a good usage of attributes - and having a good usage available, we should probably allow them.