The following fails to compile with Syntax error in eval:4: unexpected token: ifdef:
enum Something
VAL = 1
ifdef darwin
VAR = 2
end
end
I can try to implement this. And maybe try to implement ifdef inside struct/union definitions (that doesn't work either).
That will be excellent @asterite and will reduce a bit of duplication when defining structures/enums across POSIX platforms (I know, right now linux/darwin, but there are others) :smile:
Is this still valid with #2710?
Kind of, we still can't have macros in enum's
enum Something
VAL = 1
{% if flag?(:darwin) %}
VAR = 2
{% end %}
end
end
Syntax error in ./bug.cr:4: unexpected token: {%
{% if flag?(:darwin) %}
Though I'm not sure whether that perhaps makes it a duplicate of #424
I think that this issue is a dupe now.
well #424 is about macro calls.
Okay, I see the difference now.
I can probably fix this for 0.18.0
Since it was impossible, not implementing ifdef in enum is fine, since it would just end up being removed in favor to macro calls with flags? a bit later.
Most helpful comment
I can try to implement this. And maybe try to implement
ifdefinside struct/union definitions (that doesn't work either).