I have:
type Package = abstract member Date : int abstract member Save : unit -> unit [<type:StructLayout(LayoutKind.Sequential, Pack=1, CharSet=CharSet.Ansi)>] type Instant(date : int, value : int) = let mutable _date = date let mutable _value = value member X.Value : int = _value interface Package with member X.Date : int = _date member X.Save() = ...
but getting error: Only structures and classes without implicit constructors can be assigned the StructLayout attribute
so I understand that it should be something similar:
type Instant = struct val Date : byte array ...
But in this way I lost my interface. In C #, for example, adding type:StructLayout possible for this type of class (I think). How do I reorganize my code to avoid this error?
source share