fslang-suggestions icon indicating copy to clipboard operation
fslang-suggestions copied to clipboard

Remove ML compatibility support

Open kerams opened this issue 11 months ago • 18 comments

I propose we remove any and all traces of ML compatibility from the language and compiler. #1064 #985 have been in effect for a couple of years now (the deprecation of some other ML features has been indicated for even longer), and while it is still possible to compile some ML constructs with /mlcompatibility /langversion:5.0, such code by default fails to compile with a deprecation message.

let x: (int, int) Map = Map.empty;;
-------^^^^^^^^^^^^^^

stdin(1,8): error FS0062: This construct is deprecated. The use of multiple parenthesized type parameters before a generic type name such as '(int, int) Map' was deprecated in F# 2.0 and is no longer supported. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'.

With the proposed change, the line above would fail to compile with a generic parser error regardless of any flags.

Pros and Cons

The advantages of making this adjustment to F# are a minor simplification of F# lexer/parser and a couple of other places across the compiler and its test suite. mod, land, lor, lxor, lsl, lsr and asr will be released and usable as identifiers.

The disadvantages of making this adjustment to F# are people trying to compile old codebases with ML constructs will be left in the dark, and people actively making use of /mlcompatibility /langversion:5.0 will have to keep using an older SDK.

Extra information

Estimated cost (XS, S, M, L, XL, XXL): S-M

Related suggestions: #1064 #985

Affidavit (please submit!)

Please tick these items by placing a cross in the box:

  • [x] This is not a question (e.g. like one you might ask on StackOverflow) and I have searched StackOverflow for discussions of this issue
  • [x] This is a language change and not purely a tooling change (e.g. compiler bug, editor support, warning/error messages, new warning, non-breaking optimisation) belonging to the compiler and tooling repository
  • [x] This is not something which has obviously "already been decided" in previous versions of F#. If you're questioning a fundamental design decision that has obviously already been taken (e.g. "Make F# untyped") then please don't submit it
  • [x] I have searched both open and closed suggestions on this site and believe this is not a duplicate

Please tick all that apply:

  • [ ] This is not a breaking change to the F# language design
  • [x] I or my company would be willing to help implement and/or test this

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.

kerams avatar Feb 09 '25 11:02 kerams