Open sangkilc opened 2 years ago
This would make it possible to write include guards (like in C/C++), which would prevent multiple defines when using scripts.
A.fsx
#if !A_FSX
#define A_FSX
let a = 123
#endif
B.fsx
#load "A.fsx"
C.fsx
#load "A.fsx"
#load "B.fsx"
Although I would prefer if there were an idempotent variant of #load
- perhaps based on hashing?
I run into this, in particular when using #if
directives in library code which I want to test in FSI, (most recently checking against FABLE_COMPILER
). #define
would be useful even if it were an FSI-only feature.
I propose we add
#define
and#undef
preprocessor directives for conditional compilation (as in C#: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives#defining-symbols).Pros and Cons
The advantages of making this adjustment to F# are
Honestly, I don't know if there's any disadvantage.
Extra information
Estimated cost (XS, S, M, L, XL, XXL): S
Related suggestions: I was not able to find relevant issues.
Affidavit (please submit!)
Please tick this by placing a cross in the box:
Please tick all that apply:
For Readers
If you would like to see this issue implemented, please click the :+1: emoji on this issue. These counts are used to generally order the suggestions by engagement.