let a = ref 0 let f (x: byref<int>) = x f a // type error System.Int32.TryParse("123",a) // works
f abeing a type error is puzzling, because it acan be passed to .NET library methods with a type byref<int>. Why?
f a
a
byref<int>
Edit: I think I really explained this question poorly. Type System.Int32.TryParse- string * byref<int> -> boolbut it works. So why can't I pass ain a type function x:byref<int> -> int? That is all I ask.
System.Int32.TryParse
string * byref<int> -> bool
x:byref<int> -> int
8.13.7 F # spec. ref, byref, ", ", , .
ref
byref
, , - , :int ref byref<int>
:int ref
:
let a = ref 0 let f (x: int ref) = x f a // type error System.Int32.TryParse("123",a) // works
: , . F #, , F # . , , # , , . , byref<int>, .NET , out, out #. .
Source: https://habr.com/ru/post/1682555/More articles:Is it safe to make a reference element to a constant of a temporary variable? - c ++Laravel 5: How to load database values ββinto config / services.php file? - phpHow to round all prop.table values ββin R in one line? - rAdd a new CSS class to the Chrome developer tool - cssTable as parameter for function with table value from Exec query in SQL - sqlSQL query to select last X records for a specific non-primary field - sqlConsole application with alarm pump - c #Type expression does not match expected type B - scalaCallback from Delphi DLL in C # - only works in winform standby mode or using app.doevents? - c #How to use IPFS from a Javascript application without starting ipfs node? - javascriptAll Articles