Enum: fixed #4269, work fine with private#4314
Enum: fixed #4269, work fine with private#4314makenowjust wants to merge 1 commit intocrystal-lang:masterfrom
Conversation
8333185 to
ade9053
Compare
|
The expanded code is not that nice since it use the values of the enum instead of their name. But it is a clever workaround. |
|
Can we merge this for now and add a |
|
I think |
|
@asterite I don't think |
|
They are not evil, they just don't work well with other features. That means they weren't thought through, and it's better to remove them than to have a broken feature. Also Ruby and Python don't have visibility modifiers for types and they work fine. |
|
I think private types should just have a name that the user won't be able to type and make it imposible to reopen outside the file. With that the metaprograming type expansion will work. I see them as like annonymous type of other languages. At the end of the day private methods are also obfuscated method names. |
Fixed #4269.
Use
new({{@type.constant member}})instead of{{@type}}::{{member}}. It works fine. However I think,Enum.flagsmacro cannot implement correctly on current Crystal compiler.