Skip to content

.NET 9 compat features assessment #16967

@vzarytovskii

Description

@vzarytovskii

We need to assess which features we will need to support in F# 9

  1. Params collections: developers can now put params in front of many more collection types in signatures including Span.

    • Minimum (targeted for F# 9): Make sure F# compiler can work with those, even if F# user has to construct collection type by hand
    • Extra (out of the picture for F# 9): Implement the Span+ReadOnly span part of the proposal
    • Full support (out of the picture for F# 9): F# compiler has to learn all the rules on how to construct collection on behalf of the developer (i.e. translate from MethodCall(1,2,3) to MethodCall(MyFancyType.Create().Add(1).Add(3).Add(3)) or similar following the full spec
  2. ref struct generics and interfaces :
    A ref struct can now both implement an interface

  3. A type parameter can now be (anti)constrained to allow ref struct arguments

    • Minimum (targeted for F# 9): Consume types with these constraints, and full tooling support.
    • Full support (out of the picture for F# 9): Author such types in F# (because of escape analysis rules).
    • Covered by Support ref structs in generics #16800
  4. Extension types: this is a new way of declaring extension members (both static and instance)

    Cut from C# for .NET9, so we don't need to do it now - Minimum (targeted for F# 9): Support calling methods with such augmented types (extensions). C# feature still has a lot of TODOs, which means we'll likely won't be able to start working on it until C# has a working prototype implemented. This will still need an RFC and design. - 3 design decisions will need to be made: - Support for extension members - Support for extension static members - Support for extension that implement interfaces - Support of such extensions in SRTPs. - Full support (out of the picture for F# 9): Shall there be an abillity to declare such extensions for consumption from both F# and C# (i.e. expanding our type augmenation and extensions support). This is up to @dsyme to approve/reject.
  5. Overload resolution priority: developers can add weight to which methods are better in overload resolution. This seems unlikely to impact F# as much.

    • Minimum (targeted for F# 9): Making sure everything works as expected (i.e. as if there's no attribute)
    • Extra (might be targeted for F# 9 if there's capacity): If attribute is present, incorporate sorting by this attributes in case of conflicts (i.e. only if F# would complain about not being able to pick a method anyway) => minimal risk of breaks.
    • Full support (out of the picture for F# 9): Reverse engineer the method resolution spec changes, transform and adapt into a new suggestion+F# RFC which changes method resolution incl. relevant type inference changes (not covered in the C# spec).

We will likely need to look at 1 and see it doesn't break, but no rush supporting it in F# 9 (since we're pretty much at capacity currently), 2 and 3 will need to be supported, 4 is the same as 1 for the release (i.e. make sure nothing is breaking, wider support will require separate design based on final set of features implemented in C#), 5 will be likely out of the picture for F# 9.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions