[RFC FS-1095] Discussion thread for RequireNamedArgument #538
Replies: 3 comments 6 replies
-
I'm curious about your thought process on a few points that weren't clear from the summary post in the suggestion thread:
type Foo() =
[<RequireNamedArgument>]
static member Bar(bar: int) = bar
static member Baz([<RequireNamedArgument>] baz: int, c) = baz + c
type Foo() =
[<RequireNamedArgument>]
static member Bar (x, y) = x + y
(1,2)
|> Foo.Bar |
Beta Was this translation helpful? Give feedback.
-
In the RFC, there are unresolved questions about behaviour in context of type hierarchy / virtual methods. I'm gearing toward making the attribute enforced without the need to define it again if you override a method implementation (as well as implement in case of abstract member). Reasoning is that if the choice is made in a base type, the design choice should carry automatically on the whole type hierarchy. I don't think it is worth having a way to revert that with a separate attribute, it is trivial to wrap the method in another method or function that won't enforce the named arguments at call sites. If that seems counter-intuitive or to be the wrong choice, please engage and share your point of view. |
Beta Was this translation helpful? Give feedback.
-
There is now a suggestion for bringing the attribute to BCL: dotnet/runtime#51451 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm gonna require the name of people coming with an argument.
Beta Was this translation helpful? Give feedback.
All reactions