Overload with different signature works.
> type System.String with - member s.ToString(arg) = arg + " : " + s;; type String with member ToString : arg:string -> string > "World".ToString();; val it : string = "World" > "World".ToString("hoge");; val it : string = "hoge : World"
but overload with same signature does not work because extended one is ignored.
> type System.String with - member s.ToString() = "characters: " + s;; type String with member ToString : unit -> string > "World".ToString();; val it : string = "World"And, override, is totally fails, because keywords both override and base are allowed with existing inherit clause.
> type System.String with - override s.ToString() = "characters: " + base.ToString();; override s.ToString() = "characters: " + base.ToString();; -------------^^^^^^^^^^^^ /Users/youhei/stdin(2,14): error FS0854: Method overrides and interface implementations are not permitted here
No comments:
Post a Comment