Skip to content

Commit

Permalink
Update FS-1124-interfaces-with-static-abstract-members.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dsyme authored Jun 24, 2022
1 parent ffb5896 commit bb55370
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions RFCs/FS-1124-interfaces-with-static-abstract-members.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# F# RFC FS-1124 - Interfaces with static abstract members
# F# RFC FS-1124 - Interfaces with static abstract members (IWSAMs)

The design suggestion [Support static abstract members in interfaces](https://github.com/fsharp/fslang-suggestions/issues/1151) has been marked "approved in principle". This RFC covers the detailed proposal for this suggestion.

Expand All @@ -21,6 +21,10 @@ See motivation at https://github.com/dotnet/csharplang/issues/4436 and https://g

Static abstract members allow statically-constrained generic code. This is being utilised heavily in the [generic numeric code](https://visualstudiomagazine.com/articles/2022/03/14/csharp-11-preview-feature.aspx) library feature of .NET 7.

This feature sits uncomfortably in F#. Its addition to the .NET object model has been driven by C#, and its use in .NET libraries, and thus consuming and, to some extent, authoring IWSAMs is necessary in F#. However there are many drawbacks to its addition, documented below.

Because of this, we will consider requiring a special opt-in before new IWSAMs are declared in F#.

## Considerations

F# has an existing mechanism for statically-constrained generic code called SRTP (statically resolved type parameters). These have considerable advantages and disadvantages:
Expand All @@ -30,12 +34,6 @@ F# has an existing mechanism for statically-constrained generic code called SRTP

This RFC must consider any interactions between SRTP constraints and static interface constraints.

## Limitations

This feature sits uncomfortably in F#. Its addition to the .NET object model has been driven by C#, and its use in .NET libraries, and thus consuming and, to some extent, authoring IWSAMs is necessary in F#. However there are many drawbacks to its addition, documented below.

Because of this, we will consider requiring a special opt-in before new IWSAMs are declared in F#.

## Detailed design
[design]: #detailed-design

Expand Down

0 comments on commit bb55370

Please sign in to comment.