Tupled arguments and multiple arguments are not equivalent for .NET object model members. This also applies to F# object model members. This is because resolving .NET method overloading regularly requires the use of numbers of arguments as part of the resolution.

You can use

1
2
3
 
type Point = Point of int * int
    member this.CreateWall(Point(x,y)) = ...

or write

1
2
3
4
 
member this.CreateWall point = 
    let (x,y) = point 
     ...

This does break with OCaml convention but is also a key design decision to ensure that .NET libraries that make heavy use of overloading (i.e. just about every use of a .NET library) are palatable to use from F# and give good error messages when things go wrong.

Kind regards

Don

By on 11/14/2007 6:20 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us
Built with WebSharper