fsharp / fsharp/fslang-suggestions
Align precedence of infix operators with a dot prefix to F# spec
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 373
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
I propose we adjust the precedence for infix operators with a leading dot, such as (.&&) , (.||), (..&&), etc. , to make them equivalent to their counterparts without the leading dot, such as (&&), as specified in the F# language specification.
The existing way of approaching this problem in F# is to use additional brackets to achieve the correct order of operations, but this does not match the language specification and causes confusion and unexpected behavior.
Pros and Cons
The advantages of making this adjustment to F# are:
- Aligns the behavior of the F# compiler with the language specification.
- Provides a more consistent and intuitive experience for developers.
- Resolves the issue with expressions like
a = b .&& b > cnot matchinga = b && b > c.
The disadvantages of making this adjustment to F# are:
- May introduce breaking changes to existing F# code that relies on the current precedence behavior for infix operators with a leading dot.
Extra information
Estimated cost (XS, S, M, L, XL, XXL): S
Related suggestions: None
Affidavit (please submit!)
Please tick this by placing a cross in the box:
- This is not a question (e.g. like one you might ask on stackoverflow) and I have searched stackoverflow for discussions of this issue
- I have searched both open and closed suggestions on this site and believe this is not a duplicate
- 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.
Please tick all that apply:
- This is not a breaking change to the F# language design
- I or my company would be willing to help implement and/or test this
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no implementation files, tests, or compiler entry points. Start by comparing the F# specification's precedence rules with the current behavior for dotted and non-dotted infix operators, then identify the relevant compiler area and add coverage for the examples in the issue. Done means the compiler behavior matches the specification while accounting for the noted breaking-change risk.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fsharp
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100