You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this is a reasonable suggestion, can you copy this over to https://github.com/fsharp/fslang-suggestions? It is where suggestions go and can be upvoted. It is used for suggestions that require a language, core lib or syntax change. If accepted by Don, we will then proceed with an RFC and, hopefully, an implementation.
Note that there's some prior discussion here: fsharp/fslang-suggestions#273 (if you look at the archived comments, you can see that that was still from the F# 4 days in Codeplex. The design of the time is gone, but clearly, the part that says #elif didn't make it into the language at the time).
edit, note that #if can be nested, so your code example may be easier if turned into this:
let myPath =
#if WIN64
"/library/x64/runtime.dll"
#else
#if WIN86
"/library/x86/runtime.dll"
#else
#if MAC
"/library/iOS/runtime-osx.dll"
#else
"/library/unix/runtime.dll"
#endif
#endif
#endif
(I mean, it would be easier to read with your suggestion, but at least you won't need the complex boolean expressions)
F# seems to have
#elif
preprocessor directive / pragma missing:https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/compiler-directives#preprocessor-directives
C# has it:
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives#conditional-compilation
I know it's not good practice to use lot of these, I'm not trying to do a templating engine, I would just like to do a simple switch like this:
The current workaround:
The text was updated successfully, but these errors were encountered: