would it be possible to have, say, @feature("name") and @noFeature("name")?
the usecase would mainly be to avoid dependencies that are only required for uncommonly used features
(… so it would require support on bsconfig’s side too, which isn’t ideal but oh well)
to be fair, there would be… a number of problems with implementing it nicely - the biggest one being that to validate every combination of features, you’d need to compile it 2^numberOfFeatures times
also i’m not sure whether it’s even possible to have, say, two declarations of the same function, e.g.:
// contrived example
type t
@feature("a") let foo: (string) => t = "%identity"
@noFeature("a") let foo: (int) => t = "%identity"
small problem… is it possible to set any of the compile time variable in the bsconfig? (because i’d want to turn features on/off when importing, like rust)
I have a single OCaml file in my project to use conditional compilation; it’s a bit awkward but the file doesn’t need to change much so it’s generally fine.