Skip to content

Conversation

@gusty
Copy link
Member

@gusty gusty commented Nov 12, 2022

This will take advantage of static interfaces, which is the natural way of conding the IEncoding interface.

The question is what do we do with codec for interfaces which uses Ad-Hoc Encoding which relied in an instance to call the interface methods.

@gusty gusty force-pushed the gus/static-interface branch from d0a3b42 to 5cc8202 Compare November 12, 2022 19:17
Assert.StringContains ("", "brand", stjGCarJson)

do ICodecInterface<IVehicle>.RegisterCodec<AdHocEncoding, Truck> Truck.ObjCodec
do ICodecInterface<IVehicle>.RegisterCodec<Fleece.SystemJson.Encoding , Truck> Truck.ObjCodec
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@wallymathieu
Copy link
Member

My feeling is that you could register multiple for the subset that you care about, why ad hoc encoding might be less useful in reality.

@wallymathieu
Copy link
Member

There was surprisingly few changes that I had to do in order to get it working with a sample project:
wallymathieu/auctions-api-fsharp#38

@gusty
Copy link
Member Author

gusty commented Nov 13, 2022

Well it seems only one in the code: Decode.Fail.propertyNotFound prop (o |> map (fun x -> x :> IEncoding)).
Which makes sense, because the old code was definitely wrong, the function should had always take care of the cast for you.
Actually I think if you used the 0.10.0 release you could had removed it.

@wallymathieu
Copy link
Member

I'll try it then 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants