Skip to content

Instantly share code, notes, and snippets.

@bleis-tift
Created September 24, 2012 07:36
Show Gist options
  • Save bleis-tift/3774779 to your computer and use it in GitHub Desktop.
Save bleis-tift/3774779 to your computer and use it in GitHub Desktop.
型拡張でオーバーロードすると式木が取れない
// fsiで
type Hoge() =
member this.Piyo(i: int) = "piyo1"
member this.Piyo(s: string) = "piyo2"
let f () =
<@ (fun (h: Hoge) -> h.Piyo(42)) @>;; // <- ここと、
type Hoge with
member this.Foo(i: int) = "foo1"
member this.Foo(s: string) = "foo2"
let g () =
<@ (fun (h: Hoge) -> h.Foo(42)) @>;; // <- ここのダブルセミコロンを取ると動く
f () // OK
g () // NG
;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment