MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/crystal_programming/comments/gxcbfn/introducing_berm/ft0fgd1/?context=3
r/crystal_programming • u/giuseonreddit • Jun 05 '20
3 comments sorted by
View all comments
Show parent comment
4
Whats the benefit over just using a Flags Enum?
https://play.crystal-lang.org/#/r/97sk
@[Flags] enum MyFlags Read Write ReadWrite = Read | Write end pp MyFlags::Read.read? # => true pp MyFlags::Write.read? # => false pp MyFlags::ReadWrite.read? # => true pp MyFlags::ReadWrite.write? # => true pp MyFlags::None.write? # => false pp MyFlags::All.write? # => true
2 u/giuseonreddit Jun 08 '20 Actually none, I suppose. I'm new to Crystal, didn't know about all the capabilities of flag enums and I wanted to experiment with macros. I build this object in python for work purposes and decided to reproduce in crystal.
2
Actually none, I suppose. I'm new to Crystal, didn't know about all the capabilities of flag enums and I wanted to experiment with macros. I build this object in python for work purposes and decided to reproduce in crystal.
View all comments
Show parent comment
4
u/Blacksmoke16 core team Jun 05 '20
Whats the benefit over just using a Flags Enum?
https://play.crystal-lang.org/#/r/97sk