List all -D defines in a project/lib/std

Hej all,

As the topic suggest, could it be possible to have a compiler option that list all -D (defines) used in a projet, in a lib or in the std lib please ?
I think it could be good because sometimes it’s hard to find

Thanks for reading me,
Regards,
Michal

Hi!

You can access this in a macro with haxe.macro.Context.getDefines() (haxe.macro.Context - Haxe 4.2.1 API)

Thanks for your answer.
I think I have not explained well my request :
I wanted to know all the defines that are available in a lib, in a projet, not the ones used (activated)
For example if somewhere in a used code there is a #if canvas … #end , so I want to get this one.
It could give me the possibilities…
Maybe it’s more clear ?

I don’t think there’s any way to do this right now. There’s a related discussion on the Haxelib repository:

I just read that.
But I don’t understand why it couldn’t be possible because Haxe compiler parse all the used code and looks at the defines, so when it read one (to check if it’s activated) it could easily push it in an array, don’t you think ?

Then you’d just have a list of defines, without any documentation of what they do, which lib “introduces” them etc… Is that really all that helpful?

Writing them in haxelib could be a good thing but many people wouldn’t fill it IMHO. or just forgot between versions.
Having a simple list could help yes if the defines are well named, their name have a sense.
For example #webgl, #cairo, #canvas talk by themselves I think. And once again, I think, maybe I’m wrong, that it isn’t something difficult to do while parsing/typing code.