3 ms·
What other compiled language has a significantly better way of solving compile-time flags?
by usrnm 2y ago
What other compiled language has a significantly better way of solving compile-time flags?
- orf 2y agoRust has a pretty nice setup. Definitely doesn’t require workarounds like the chromium-style build flags pattern. I’m sure there are others.
- vlovich123 2y agoThere’s plenty of problems in rust once you leave the happy path. For example, how do you specify a default set of feature flags based on the target? Turns out you can’t actually - you can change the flags via build.rs but unlike normal feature flags they’ll only apply to the current crate (ie it doesn’t enable anything that your feature would when enabled on the command line because the latter applies to resolution but build.rs happens later when resolution is fixed). Similarly, doing this stuff via conditionals in cargo.toml can do certain things but not others.
- orf 2y agoNothing is perfect, but a well defined and discoverable set of features, built into the language and checked for validity is great. Also having it be a feature system and not shoved into one big pre-processor soup (I.e the same thing as build time constants) is also good. Having them support groups and compose together is even better. There are other languages that improve on c/c++, but rust is just top of my mind right now.