-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Enum.jl is missing broadcasting functions #28842
Comments
Perhaps it makes sense to iterate an enum, but note that you can do this:
|
I know @fredrikekre, but going down that road I am sure to write |
I don't think an Enum should be iterable so the solution would be to define |
Would you mind elaborating why not @KristofferC? I see them defined for ::Number in
|
The fact that numbers are iterable has been a point of discussion (#7903) but Enums are not numbers so it doesn't apply here. Why do you want to iterate Enums? |
Thank you for pointing me to discussion #7903. I now understand why you want enum values to be broadcastable, but not iterable. I still find it weird though to construct a new iterable object to hold the enum value. I mean |
Using a trait for what is considered scalars w.r.t broadcasting has been discussed but, for now, the way to do it is to wrap it in a length one iterable container. |
Closed by #30670 |
The following example
gives me
The
Enum.jl
file should include the following functionswhich would allow
x .== A
to result in the expected resultThe functions could also be defined for the subtype
::Tags
via the@enum
macro, if this is desirable?The text was updated successfully, but these errors were encountered: