Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type
- Color = enum
- red, orange, yellow, green, blue, indigo, violet
- # Goal: access the ordinal value of c
- # Issue: macros parameters are passed as type NimNode
- # and I cannot access the ordinal value
- macro color_test*(c: Color): typed =
- #c.intVal <- this doesn't work "f"
- # what I want to do
- # if ord(c) >= ord(yellow): ...
- return
- #this is functional
- var c = yellow
- if ord(c) > ord(orange): discard
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement