fsharp / fsharp/fslang-suggestions

More opt-in warnings

Open
#1,197 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
373
Forks
21
PR merge metrics
No merged PRs in 30d

Description

I suggest adding a set of optional warnings for use of features which some users might want to discourage in their codebases.

F# has many features, which vary in safety and explicitness, and as it grows features are added which appeal to different groups, and are rarely subtracted. A team may decide that some features are disadvantageous to a codebase, and this currently can only be enforced by a style guide.

I am particularly interested in enabling warnings on use of features that increase informality, decrease explicitness of code, or decrease type safety, but others may have different features that they want to discourage.

**Old features**
- Use of a downcast `:?>`
- Use of a type test `:?`
- Use of reflection (covered in another language suggestion)

**New features**
- Implicit yields

**Proposed features**
- Anonymous type-tagged unions
- Record name punning

Existing warnings are here: https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/compiler-options#opt-in-warnings . There are already some that allow control of implicit conversions, which I find very helpful (even to the extent of varying strictness depending on the type of library).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the existing opt-in warnings in the F# compiler options documentation and the issue's discussion. Narrow the proposal to specific features, determine which warnings are wanted, and establish acceptance criteria before locating the relevant compiler implementation and tests.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.