First off, I have a better method of dealing with this issue so it's not a problem.
However, it is something that I don't understand. Can someone explain this?
When I define the swap function as:
namespace Utilities
module Misc
let Swap (left : 'a byref) (right : 'a byref) =
let temp = left
left <- right
right <- temp
I am able to use the Swap function like this just fine.
Misc.Swap (&s.[i]) (&s.[j])
But when I define the module like:
namespace Utilities
type Misc =
static member Swap (left : 'a byref) (right : 'a byref) =
let temp = left
left <- right
right <- temp
I get the following error on both arguments:
This expression has type 'b byref but is here used with type 'a ref
How did the type inference for the caller's arguments change by moving the function into a type?