-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add docs for Enum#value
#11947
Add docs for Enum#value
#11947
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I think this could be put in |
@asterite help me here, if it isn't listed in |
I couldn't find a |
This PR is probably fine, though! |
Found it! Not very documentation-friendly though. crystal/src/compiler/crystal/types.cr Lines 2736 to 2741 in 58e8fc5
|
Nice! But then, since it's a primitive, it might make sense to move it to |
Actually it's impossible to do because value's type depends on the enum type. Enum should somehow be generic, but currently it's not. |
With that in mind, maybe doing nothing for now is better |
We need struct Enum(T) where T < Int Ref #934, which even has a proposed implemented according to #934 (comment) |
Yes, it's a regular method and can be overriden by implementing types. It's definitely not pseudo. The docs are fine. I think we could just move them to |
I noticed this method wasn't really documented, although it is used in a doc example.