GithubHelp home page GithubHelp logo

Comments (6)

sirthias avatar sirthias commented on June 19, 2024 1

borer derivation is intentionally not fully "auto-magic", because this often leads to issues down the road.
See this ticket for example: softwaremill/magnolia#79

Consider this snippet for example:

case class Foo(int: Int, qux: Qux)
case class Bar(qux: Qux)
case class Qux(...)

If deriveCodec[Foo] would automatically also derive the codec for Qux then this Codec[Qux] wouldn't be visible during derivation of Codec[Bar]! Which means that deriveCodec[Bar] would generate Codec[Qux] again!
And you wouldn't see this duplication anywhere!

In this small example this might not be an issue but for large model hierarchies these kinds of invisible duplications can create huge amounts of code, that takes a long time to compile and can create a number of strange issues.

In our experience it's indeed better to manually cache codecs for all types in implicit vals, which takes only a single line.
This results in the minimal amount of code, fastest compilation and runtime performance as well as full transparency on which type classes are actually available and which aren't.

from akka-serialization-helper.

PawelLipski avatar PawelLipski commented on June 19, 2024

Let's assess https://github.com/plokhotnyuk/jsoniter-scala in this context

from akka-serialization-helper.

MarconZet avatar MarconZet commented on June 19, 2024

Let's assess https://github.com/plokhotnyuk/jsoniter-scala in this context

Hmm...
Jsoniter philosophy seams difrent form Borer.
JsonValueCodec[A] is "fat". It contains all information required to serialize and deserialise class.
Borer's codeces are more like layers. One codex feeds into another, breaking down object into simpler and simpler elements.

from akka-serialization-helper.

PawelLipski avatar PawelLipski commented on June 19, 2024

Hmmm okay but jsoniter claims that it can cooperate with Borer somehow (generate Borer-compatible codecs?)... this is probably going to be useful for our use case (?)

from akka-serialization-helper.

PawelLipski avatar PawelLipski commented on June 19, 2024

@sirthias can you think of any ready solution here? Like jsoniter-scala or sth else Magnolia-based?

from akka-serialization-helper.

PawelLipski avatar PawelLipski commented on June 19, 2024

Okay, that's a valuable point... so maybe we @MarconZet should not go down this rabbit hole indeed, and instead focus on #5 to prevent runtime errors

from akka-serialization-helper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.