fsharp / fslang-suggestions

The place to make suggestions, discuss and vote on F# language and core library features
344 stars 21 forks source link

Support C# parameters with default values followed by ParamArray #1267

Open cmeeren opened 1 year ago

cmeeren commented 1 year ago

I propose we support C# parameters with default values, like the below (from FluentAssertions):

public AndConstraint<TAssertions> BeNull(string because = "", params object[] becauseArgs)

In C#, this can be called as BeNull(). However, in F#, we have to supply the because parameter and therefore have to write BeNull("").

Pros and Cons

The advantages of making this adjustment to F# are: Working as expected, same as existing optional parameters.

The disadvantages of making this adjustment to F# are: None.

Extra information

Estimated cost (XS, S, M, L, XL, XXL): S

Related suggestions: (put links to related suggestions here)

Affidavit (please submit!)

Please tick this by placing a cross in the box:

Please tick all that apply:

For Readers

If you would like to see this issue implemented, please click the :+1: emoji on this issue. These counts are used to generally order the suggestions by engagement.

vzarytovskii commented 1 year ago

The disadvantages of making this adjustment to F# are: None.

Disadvantage is probably that we're risking to break current method resolution corner cases.

vzarytovskii commented 1 year ago

By the way, it's only a problem, when there is ParamArray in signature