[HN Gopher] Cgp-serde: A modular serialization library for Serde...
___________________________________________________________________
Cgp-serde: A modular serialization library for Serde powered by CGP
Author : maybevoid
Score : 12 points
Date : 2025-11-03 13:07 UTC (11 days ago)
(HTM) web link (contextgeneric.dev)
(TXT) w3m dump (contextgeneric.dev)
| maybevoid wrote:
| Author here, glad to see this featured on HN! AMA about Context-
| Generic Programming or Rust traits!
| carterschonwald wrote:
| How does it avoid the challenges and needed ergonomics in scala.
| Like I think they rolled it back for scala 3?
| maybevoid wrote:
| The providers in CGP work a little different than implicit
| parameters in Scala. Specifically, the provider implementations
| are bound to a `Context` or `Self` type during compile-time
| wiring. So if you know the concrete `Context` type, then you
| can resolve all provider implementations for that context.
|
| Because the wiring is done globally for an explicit `Context`
| type, there is no issue of ambiguity that arise based on when
| an implicit parameter is bound. I call this scoped coherence,
| as it leverages incoherence for overlappable implementations,
| but still maintain global coherence through the wiring in a
| context type.
___________________________________________________________________
(page generated 2025-11-14 23:01 UTC)