[RFC FS-1137 Discussion] prefer extension method over intrinsic properties when arguments are provided #752
smoothdeveloper
started this conversation in
Language and core library RFC discussions
Replies: 2 comments
-
Should the same apply to type extension as well? IMO they should work the same. type Aze() =
let mutable x = 1
member _.X with get () = x and set value = printfn "intrinsic setter"; x <- value
module Foo =
type Aze with
member x.X (a:int) = printfn "type extension setter"; x.X <- a; x
let a = Aze()
a.X <- 2
open Foo
a.X(2).X(3).X(4) |
Beta Was this translation helpful? Give feedback.
0 replies
-
C# doesn't support indexed property (beside class level); there also are edge cases when hiding F# indexed properties with methods, and it becomes worse in context of overloaded indexed properties. I suggest the feature only applies to non indexed properties, it remains impossible to hide an indexed property through type extension and extension methods. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Suggestion: fsharp/fslang-suggestions#1039
RFC: RFC FS-1137
Implementation: dotnet/fsharp#16032
Beta Was this translation helpful? Give feedback.
All reactions