I'm not able to find how to declare a function in an interface so that I have a Tuple or byref result.
I want to simulate this syntax:
let executed, value = Int32.TryParse("123")
Let's say that I have a function with 2 input parameters and I want to know if the result is successful and in case having the result (a Record type in this case). Kind of:
type Result = {reference:string; value:decimal}
type IExecutor =
abstract member DoStuff: (aa:string) * (bb:string) * (result:byref<Result>) -> bool
abstract member DoStuff: (aa:string, bb:string, result:byref<Result>) -> bool
type Executor () =
member this.DoStuff (aa:string, bb:string, result:byref<Result>):bool =
result <- {reference="ref"; value=0m}
false
let executed, result = executor.DoStuff "aa" "bb"
or
let executed, result = executor.DoStuff("aa", "bb")
I'm not able to declare DoStuff in the interface.
The second try is a copy of the Int32.TryParse signature I see from intellisense, why doesn't work?
What is the correct syntax for having DoStuff called as I want ?
outrefparameter, see docs.microsoft.com/en-us/dotnet/fsharp/language-reference/… - Abel