This sample re-implemented haxe.macro.Compiler.getDefine(), giving the impression that you must re-implement it. It's much better to encourage people to use standard library functionality.
The sample also re-implemented conditional compilation, and its implementation had an error. It would always call setDefine("foo", "bar") regardless of the result of isDefined(). By using conditional compilation instead, we can avoid accidentally overwriting foo.
This sample re-implemented
haxe.macro.Compiler.getDefine()
, giving the impression that you must re-implement it. It's much better to encourage people to use standard library functionality.The sample also re-implemented conditional compilation, and its implementation had an error. It would always call
setDefine("foo", "bar")
regardless of the result ofisDefined()
. By using conditional compilation instead, we can avoid accidentally overwritingfoo
.