Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A round of deprecation of OCaml compatibility language features #985

Closed
dsyme opened this issue Mar 2, 2021 · 1 comment
Closed

A round of deprecation of OCaml compatibility language features #985

dsyme opened this issue Mar 2, 2021 · 1 comment

Comments

@dsyme
Copy link
Collaborator

dsyme commented Mar 2, 2021

I propose we deprecate certain existing corner-case features of F#

  • Make the use of the ".ml" and ".mli" file extensions give errors on command line and IDE by default and no longer give direction to the "/mlcompatibility" flag but rather go via an https://aka.ms link explaining this feature is being removed (they currently give textual warnings directing to use "/mlcompatibility")

  • Make the “/mlcompatibility” flag hidden and give a deprecation warning on use (it is currently accepted without a warning) with the same https://aka.ms link

  • This also covers the (* IF-OCAML .. *) and other things that require "/mlcompatibility".

  • When "#indent “off” and #light “off” are used (in command line compiler or the IDE) they should give the same error and link - again requiring "/mlcompatibility" to explicitly enable. This will not be available at all in scripts except by starting fsi with "/mlcompatibility", there will no option to enable this without an error in script editing.

    (This maybe more controversial as I believe there have historically been people using F# who prefer the indentation-off syntax. However in reality new features since F# 4.0 have only been tested with the indentation-aware default syntax. It's time to embrace this as the reality for the language)

  • The same thing applies for the infix keywords "land", "lor", "lxor", "lsr", "lsl", "mod”, "asr". These were in F# 1.0 in the language for OCaml compat and are never encouraged to be used. They should not have made it into F# 2.0+ as a "warning" and should always have been an "error".

  • Give a deprecation warning for ! and instead request the use of .Value, covered in this issue Give advisory messages when using ! and :=, and ask users to use .Value instead  #569. This may be more controversial and will affect a substantial amount of F# code. See the separate issue which has already been approved in principle.


I feel there are a few more too though I didn’t find them on a quick scan of the codebase. There are some “error” deprecations we can trim out for code cleanliness, e.g.

   errorR(Deprecated(FSComp.SR.tcObjectExpressionFormDeprecated(), m))
   errorR(Deprecated(FSComp.SR.tcUseWhenPatternGuard(), m))
   errorR(Deprecated(FSComp.SR.tcUnnamedArgumentsDoNotFormPrefix(), mMethExpr))
   errorR(DeprecatedThreadStaticBindingWarning mBinding)
   astDeprecatedIndexerNotation
   elDeprecatedOperator
@dsyme
Copy link
Collaborator Author

dsyme commented Jun 9, 2022

I'm marking this as completed, though the implementation is still in preview. For some reason it wasn't activated in F# 6.0

https://github.com/fsharp/fslang-design/blob/main/FSharp-6.0/FS-1114-ml-compat-revisions.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant