I'd love to see this feature. I've been using CRTP more and more frequently as I got more familiar and comfortable with it, but only internally so far and not for any externally consumable APIs. #4098
-
I'd love to see this feature. I've been using CRTP more and more frequently as I got more familiar and comfortable with it, but only internally so far and not for any externally consumable APIs. My favorite example use case for this is base Enumeration class, which allows consumers to derive it and inherit functionality similar to Java enumerations - each instance of a derived class gets an ordinal number and a string name properties, as well as overriden toString method and implicit casts to int and string, while each derived type itself gets a static property with a collection of all enumerations as well as static methods/index operators to access an enumeration by int or string value. This allows creating OO style enumerations with minimal boilerplate code. Some examples:
second example:
Originally posted by @TomasJuocepis in #169 (comment) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi Thanks for suggesting your idea! I've converted this issue to a discussion, as issues are only for fully fledged proposals. Would you mind changing the title to a short summary of this feature? Thanks |
Beta Was this translation helpful? Give feedback.
-
@Gopf8088 It seems like you've just copied the full post at #169 (comment) and made a discussion around it (without adding any more context of information). This makes it appear as if you may be a bot. For now, i'm going to keep this unlocked and will give you a couple of days to respond here to help clarify your good intentions here. If we can validate that this was done in good faith and can discuss good ways to start these discussions in the future. If, however, this was just some sort of automated process, we'll be locking this and we'll ask that you not create issues/discussions in this way in the future. At that point, if the behavior continues, we'll have to take more extreme and unfortunate steps to address the problem. Thanks very much! |
Beta Was this translation helpful? Give feedback.
Hi
Thanks for suggesting your idea!
I've converted this issue to a discussion, as issues are only for fully fledged proposals.
Would you mind changing the title to a short summary of this feature?
Thanks