odin-lang / odin-lang.org

http://odin-lang.org
26 stars 80 forks source link

Add a section on Conditional Compilation #110

Closed Tetralux closed 1 year ago

Tetralux commented 1 year ago

Surprisingly, I discovered that the several mechanisms Odin provides for handling conditional compilation aren't mentioned anywhere in overview. Not even the file suffixes!

Given that quite a few people have asked about this before, and that there is basically no mention of it at all, I've gone ahead and made a section about it.

This section fleshes out how when statements can be used for this, as well as the file suffixes, -defines, and build tags.

It also mentions the otherwise-undocumented build tags using language that makes it clear that users should generally prefer the file suffixes if that covers their use-cases, as the build tags are something of a specialised thing that we don't want being abused.