Skip to content

Conversation

@jangko
Copy link
Contributor

@jangko jangko commented Jul 28, 2025

fix #121

type Flavor = JsonReader.Flavor

when value is JsonString:
autoSerializeCheck(Flavor, JsonString)
Copy link
Member

Choose a reason for hiding this comment

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

this looks a bit messy - ie first we create a handler for the type, then we disable it "maybe" - it sounds expensive, compile-time wise and a bit messy to follow - ditto the use of the macro cache feels .. expensive ..

can we think of a different way to structure this code? could we make it work by specializing for Json[DefaultFlavor] and then somehow "forwarding" calls to that if the user wants to borrow that serialization, also to avoid bloat?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this looks a bit messy

Yes, a bit messy. But that is the cost of a simple interface to disable default serializer at various granularity. Both concrete type and type classes can use the same interface. Otherwise, the messiness and complexity will be more harder to follow.

could we make it work by specializing ... to avoid bloat?

Yes, but that will come in separate PR, it's a different topic, and quite thorough refactoring.

@jangko jangko merged commit 3cb486d into master Jul 28, 2025
26 checks passed
@jangko jangko deleted the auto-serialization branch July 28, 2025 15:29
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.

Add option to disable automatic serialization of primitive types

2 participants