Flaw with typed enumerators in F202X

@zedthree Your paper sounds very convincing to me. Granted I have no clue about the Fortran standard process, that might not mean a lot…

Exhaustive select statements fall under the same category in that it would be very difficult/impossible to add in a later revision (one would have to invent a new syntax). Personally I think that is an incredibly important feature, but I wonder if anyone else does so?

Of the languages @zedthree list in the paper, the following do require exhaustive matching:

  • C++ (when using std::variant)
  • Java (with the new pattern matching syntax)
  • Rust (always)
  • Switft (always)
  • TypeScript (though only through separate tooling)
  • Golang (though only through separate tooling)
  • Python (though only through separate tooling)

The following languages don’t require exhaustive matching:

  • C#
  • D
  • PHP

The following languages, I’m not sure about:

  • Ada
  • Raku

@plevold I do completely agree, and I would really like to see exhaustive matching in the standard, but this is something that you could completely emulate with something like -Wexhaustive-select -Werror compiler flags. It would definitely be better to have it in the language though. I’d be happy to help if you want to add this to my proposal, but I’m afraid I have very little time to do so myself at the moment!

1 Like

Thanks, @zedthree. I’m quite short on time these days as well. I’ll see if I’m able to write something that maybe could be included in your paper.

The new Fortran Saga?