You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make call syntax simpler for statically resolved member constraints #440
Idea 8014059: Make call syntax simpler for statically resolved member constraints
Status : planned Submitted by Andrzej Kukuła on 5/18/2015 12:00:00 AM 29 votes
The idea is basically explained by the following code:
// this works as expected
type Example() =
member __.F(i) = printfn "%d" i
let inline f (x : ^a) =
(^a : (member F : int -> unit) (x, 1))
(^a : (member F : int -> unit) (x, 2))
f (Example())
// this doesn't work
let inline f (x : ^a when ^a : (member F : int -> unit)) =
// the compiler knows that there must be member F and its signature
// so the following should be possible
x.F(1)
x.F(2)
You can also view this code highlighted at http://pastebin.com/CHMj7xQG
Activity