I suggest we ...

Allow extended #if grammar

Allow an extended grammar for #if/#elif.

#if expr

#elif expr

with grammar:

expr =
| expr && expr
| expr || expr
| not expr
| (expr)
| IDENT

With usual precedences. The syntax !IDENT should also be parsed and interpreted as “not”, though a warning given that “not” should be used instead in F# code.

The implementation must also provide sufficient tests.

6 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Don Syme shared this idea  ·   ·  Admin →

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Don Syme commented  · 

        I consider this approved in principle, though details may need to be sorted out.

        If you think this should not be done, please chime in with details below.

        If you have specific questions on the design, please chime in below.

        An implementation and testing would need to be provided by someone in the F# community (possibly including Microsoft or Microsoft Research, though not limited to them).Currently, initial implementations of approved language design can be submitted as pull requests to the "fsharp4" branch of https://visualfsharp.codeplex.com/SourceControl/latest. F# 4.0 is open for business.

        I encourage you to work towards an implementation and testing for this feature.

        Don Syme, current BDFL, F# Language

      F# Language

      Feedback and Knowledge Base