|
|
|
|
|
by cheepin
4066 days ago
|
|
"The .NET framework supports up to 32-dimensional arrays, but in the past F# only supported use of up to rank-4 arrays. Not only were arrays of rank 5+ not possible to create and manipulate from F# code, the compiler could sometimes fail to consume external libraries which relied on high-dimensional arrays. This is now fixed. Although there is not yet support for creating and manipulating high-rank arrays, the compiler will now properly handle these types up to rank-32." Has anyone here ever used "high-rank" arrays? The deepest I've ever gone was 4 for a lookup table, but I'm wondering what the use-case is for super high depth arrays as well as why there is a limit at all. |
|
The main reason for the fix was because F# pre-4.0 can't reference overloaded methods where one or more of the overloads has one or more parameters which is an array of rank 5 or more. I had a 3rd party DLL I wanted to reference, where a class had generic overloads for all of the array ranks, e.g.,:
Even though I was only trying to use MyClass.Foo(T[]), the F# compiler's overload resolution failed due to the presence of the higher-ranked array types.I'm not planning to use such arrays any time soon, but I wanted to make sure that if other code was using these arrays I could reference it from F#.