Open cartermp opened 4 years ago
If the destination kernel can't compile the type, we don't handle that for you:
https://github.com/dotnet/interactive/blob/master/docs/variable-sharing.md#limitations
Okay, gotcha. There's a quirk related to anonymous records here.
#!fsharp
let xs = System.Collections.Generic.List<_>()
for x in 1..10 do
xs.Add({| X = x |})
xs.GetType()
#!csharp
#!share --from fsharp xs
using System;
using System.Collections.Generic;
display(xs);
This fails with the same error.
However, as a compiled .NET app and within Visual Studio everything is fine.
This is accomplished via a P2P reference so maybe that's the key thing that's missing.
But a major reason behind why anonymous records exist is that they can be used to group related data trivially to aid in ad-hoc sharing/serialization/etc. scenarios.
I think the scenario makes sense but it will require some sort of translation. We would either have to load the needed references into the target kernel, or translate to new types that make idiomatic sense.
Related to #2679
Using version 1.0.131001+ff9b940c966abf0fc4c341f432c45dc2e116b42b
I have a
System.Collection.Generic.List<T>
defined in F# (via theResizeArray
type abbreviation). I'm filling it with F# anonymous record data. When sharing it with C#, it blows up.The same happens with an F# record type as well.
This is less important for records, but matters more for anonymous records. Anonymous records are the F# equivalent of anonymous types, and unblock the "talk to JavaScript" scenario.
The
.dib
file: