Open kevinresol opened 6 years ago
The code and error I have attempted is:
@:to inline function toRepresentation():tink.json.Representation<Map<K, V>>
return new tink.json.Representation(toMutable());
@:from static function ofRepresentation<K, V>(rep:tink.json.Representation<Map<K, V>>):Mapping<K, V>
return @:privateAccess ofMutable(rep.get());
Abstract Map has no @:to function that accepts IMap<tink.pure.Mapping.K, tink.pure.Mapping.V>
Try @:extern inline
... it might work ;)
It works, but I have to copy ofMutable
's body because somehow it is not inlined, instead it is referenced as an actual function which does not exist.
Currently it is serialized as
Array<MapEntry>
which could be containing redundant info.A better representation would be
Map
in the serialized form =Array<Tuple>
But somehow I couldn't make the compiler to accept that.