[RFC FS-1024 Discussion] Simplify Call Syntax for Statically Resolved Member Constraints #162
Replies: 9 comments 1 reply
-
With regards to the unresolved questions in the RFC:
Definitely. Not just for consistency reasons, but because it is equally useful with regards to static members.
Yes, because Also: Is there a simplified syntax suggestion for the |
Beta Was this translation helpful? Give feedback.
-
I would rather it looks like this: type Example() =
member __.F(i) = printfn "%d" i
let inline f (x : ^a) =
do x?.F 1
do x?.F 2 it's neat. |
Beta Was this translation helpful? Give feedback.
-
@greatim don't confuse familiarity with good design. You are just used to use ?. in C#/Kotlin/Nemerle. |
Beta Was this translation helpful? Give feedback.
-
Just like , it can be another symbol: x^.F 1
x@.F 1 whatever |
Beta Was this translation helpful? Give feedback.
-
I'd like to see fsharp/fslang-suggestions#641 considered for inclusion in this RFC as well. |
Beta Was this translation helpful? Give feedback.
-
@greatim What value is there for having a different operator there. It seems like it is not idiomatic F#, given that operator overloading is the norm. Unless you have a good argument that it's actually an entirely different operator there. |
Beta Was this translation helpful? Give feedback.
-
Are there reasons for not allowing let inline inferredMemberConstraint x = x.Foo and let inline inferredStaticMemberConstraint (x:^T) = ^T.Foo ? |
Beta Was this translation helpful? Give feedback.
-
Hello, f (x : ^a when ^a : (member F : int -> unit))
inc < ^T when ^T : (static member Inc : int -> int)> as this should be expected after the colon especially with the static specifier: f (x : ^a : (member F : int -> unit))
inc<^T : (static member Inc : int -> int)> that can lead to clean lines like: let make<'T : (new : unit -> 'T)> () = new 'T()
let inline mr<^T, ^U : (map : ^T -> ^U), ^U, ^V : (reduce: ^U -> ^V)> xs = xs |> map |> reduce and is in line with the notion to simplify the notation. It can de-sugar to include the when ^type or and ^type as needed This could be a stepping stone to getting to the version @Happypig375 has shown above. Thank you. Good day. |
Beta Was this translation helpful? Give feedback.
-
what's the status of this feature ? |
Beta Was this translation helpful? Give feedback.
-
This is the discussion thread for RFC FS-1024.
Beta Was this translation helpful? Give feedback.
All reactions