Trending
Context-Generic Programming's Avatar

Context-Generic Programming

@contextgeneric.dev

A new modular paradigm for Rust. Project account managed by @maybevoid.com. More info at https://contextgeneric.dev/

37
Followers
1
Following
56
Posts
22.12.2024
Joined
Posts Following

Latest posts by Context-Generic Programming @contextgeneric.dev

Preview
How to stop fighting with coherence and start writing context-generic trait impls - RustLab 2025 transcript | Context-Generic Programming This blog post contains the slides and transcript for my presentation of Context-Generic Programming at RustLab 2025.

How to stop fighting with coherence and start writing context-generic trait impls in Rust

contextgeneric.dev/blog/rustlab...

This blog post contains the slides and transcript for my presentation of Context-Generic Programming at RustLab 2025.

08.03.2026 21:15 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
How to stop fighting with coherence and star writing context-generic trait impls -  Soares Chen
How to stop fighting with coherence and star writing context-generic trait impls - Soares Chen YouTube video by RustLab Conference

My RustLab presentation on **How to stop fighting with coherence and start writing context-generic trait impls** is now available on YouTube:

www.youtube.com/watch?v=gXIf...

04.03.2026 15:35 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Preview
Supercharge Rust functions with implicit arguments using CGP v0.7.0 | Context-Generic Programming CGP v0.7.0 has been released, bringing a major expansion to the CGP macro toolkit. The centerpiece of this release is a suite of new annotations β€” #[cgpfn], #[implicit], #[uses], #[extend], #[useprovi...

Supercharge Rust functions with implicit arguments using CGP v0.7.0 πŸš€

contextgeneric.dev/blog/v0.7.0-...

02.03.2026 12:28 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Post image

Context-Generic Programming (CGP) now has a new website! We have now migrated from Zola to Docusaurus. This blog post explains the reasons behind the move.

contextgeneric.dev/blog/2026/02...

21.02.2026 21:29 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Preview
CGP v0.6.1 Release: Improving Ergonomics and Debugging | Context-Generic Programming

We're excited to announce the release of cgp v0.6.1, which brings several quality-of-life improvements to Context-Generic Programming in Rust.

contextgeneric.dev/blog/v0-6-1-...

02.02.2026 22:08 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

In short, cgp-serde extends Serde’s original Serialize and Deserialize traits with CGP, making it possible to write overlapping or orphaned implementations of these traits and thus bypass the standard Rust coherence restrictions.

03.11.2025 13:15 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Preview
Announcing cgp-serde: A modular serialization library for Serde powered by CGP | Context-Generic Programming

I am excited to announce the release of cgp-serde, a modular serialization library for Serde that leverages the power of Context-Generic Programming (CGP).

contextgeneric.dev/blog/cgp-ser...

03.11.2025 13:15 πŸ‘ 2 πŸ” 1 πŸ’¬ 1 πŸ“Œ 0
Preview
CGP v0.6.0 Release - Major ergonomic improvements for provider and context implementations | Context-Generic Programming

I’m excited to announce the release of CGP v0.6.0!
This version introduces major ergonomic improvements that make provider and context implementations simpler and more intuitive to write. contextgeneric.dev/blog/v0-6-0-...

26.10.2025 11:56 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Preview
CGP v0.5.0 Release - Auto dispatchers, extensible datatype improvements, monadic computation, RTN emulation, modular serde, and more | Context-Generic Programming

I am thrilled to announce the release of CGP v0.5.0! This new release includes many exciting features and improvements, including auto dispatchers, extensible datatype improvements, monadic computation, emulation of RTN, sneak preview of cgp-serde. #RustLang

contextgeneric.dev/blog/v0-5-0-...

12.10.2025 14:46 πŸ‘ 2 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

I will be presenting at RustLab on how to stop fighting with coherence and start writing context-generic programs with CGP. Use the discount code SP20FR to attend the conference with 20% discount!

26.08.2025 12:59 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Post image

Tired of fighting Rust’s coherence rules?
S@maybevoid.com introduces Context-Generic Programming: a new way to write flexible trait impls without breaking the rules.
🧩 How to Stop Fighting with Coherence and Start Writing Context-Generic Trait Impls
#rustlang #rustlab2025

26.08.2025 11:30 πŸ‘ 2 πŸ” 2 πŸ’¬ 1 πŸ“Œ 1
RustLab | How to Stop Fighting with Coherence and Start Writing Context-Generic Trait Impls Soares Chen at RustLab 2025

I will be presenting at @rustlab.it on how to stop fighting with coherence and start writing context-generic programs with @contextgeneric.dev. Use the discount code SP20FR to attend the conference with 20% discount!

rustlab.it/talks/how-to...

23.08.2025 10:51 πŸ‘ 4 πŸ” 2 πŸ’¬ 1 πŸ“Œ 0
Preview
Programming Extensible Data Types in Rust with CGP - Part 3: Implementing Extensible Records | Context-Generic Programming

The third and fourth parts of Extensible Data Types for Rust - the design and implementation of extensible records and variants - has been published!

contextgeneric.dev/blog/extensi...
contextgeneric.dev/blog/extensi...

05.08.2025 15:43 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

Through the extensible visitor pattern, you will see how to build a modular interpreter for a simple math expression language, complete with evaluation handlers that can be reused across different language versions.

10.07.2025 13:53 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Preview
Programming Extensible Data Types in Rust with CGP - Part 2: Modular Interpreters and Extensible Visitors | Context-Generic Programming

I am excited to share the second part of my blog series on Extensible Data Types with CGP. This post dives into how CGP leverages extensible variants to elegantly solve the expression problem.

contextgeneric.dev/blog/extensi...

10.07.2025 13:53 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 1

This also enables safe enum upcasting and downcasting, as well as modular builder and visitor patterns in Rust. Check out the blog post to find out more!

07.07.2025 14:00 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Preview
Programming Extensible Data Types in Rust with CGP - Part 1: Highlights and Extensible Records Demo | Context-Generic Programming

I'm excited to share the release of CGP v0.4.2, with new support for extensible records and variants! contextgeneric.dev/blog/extensi...

In short extensible data types allows us to read, construct, and deconstruct a *generic* struct or enum without needing access to the concrete type.

07.07.2025 14:00 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 1
Post image Post image

Now that Hypershell is finally published, it is finally time to go back to working on the core CGP implementation and add new features.

The new CGP builder pattern is being developed pretty smoothly. Here is a snippet Rust code on the test code and macro expansion!

17.06.2025 20:50 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 1
Preview
Hypershell: A Type-Level DSL for Shell-Scripting in Rust | Context-Generic Programming

Announcing Hypershell: a modular, type-level DSL for shell-scripting in Rust, powered by Context-Generic Programming! contextgeneric.dev/blog/hypersh...

13.06.2025 23:19 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 2
Preview
CGP v0.4.0 is Here: Unlocking Easier Debugging, Extensible Presets, and More! | Context-Generic Programming CGP v0.4.0 is officially released, bringing transformative improvements! Experience dramatically easier debugging, powerful new features, and a smoother developer journey for modular Rust programming.

I am excited to share about the new release of #CGP v0.4.0! This update solves a major challenge in debugging CGP-related errors in Rust, simplifies the developer experience with new macros, and added new features such as presets and datatype-generic programming.

contextgeneric.dev/blog/v0-4-0-...

09.05.2025 15:05 πŸ‘ 0 πŸ” 1 πŸ’¬ 0 πŸ“Œ 0
Preset Macro Improvements by soareschen Β· Pull Request #91 Β· contextgeneric/cgp Summary This PR brings a number of improvements to the CGP Presets feature, and adds better support on OOP-like inheritance on presets. Inheritance Presets can now inherit from each other a short h...

Also note that preset is an advanced concept in CGP that is yet to be formally introduced in our book. More updates will be coming very soon. But for now, you can check out the PR for a very high level overview of the changes: github.com/contextgener....

03.05.2025 20:31 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

Now before you start wondering or getting disgusted, the inheritance in CGP is quite different from the classical inheritance in the OOP world. CGP presets are more like type-level dictionaries of generic mixins. So in a way, preset inheritance is sort of like extending type-level lookup tables.

03.05.2025 20:31 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Post image

It is now possible to do OOP-like inheritance at the type-level in #RustLang using #CGP! Our latest PR brings significant improvements to defining and using presets in CGP, with support for multiple-inheritance, and override mechanism to overcome the diamond inheritance problem.

03.05.2025 20:31 πŸ‘ 0 πŸ” 1 πŸ’¬ 1 πŸ“Œ 0

There are also many other advanced improvements, such as allowing PhantomData tags and generic implementation of field accessors using AsRef.

The PR covers high level overview of all changes. For detailed walk through, stay tuned for more blog posts and updates on the book.

23.03.2025 16:45 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

This mainly improves use of CGP with idiomatic Rust code. Apparently, some readers pointed out about the aesthetic of getter methods returning &String instead of &str. This especially affects first impressions, when the hello world of CGP demonstrates the dependency injection of string fields.

23.03.2025 16:45 πŸ‘ 2 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Refactoring and Improvements on `#[cgp_getter]` by soareschen Β· Pull Request #81 Β· contextgeneric/cgp Summary This PR brings several quality of life improvements on the proc macros #[cgp_getter] and #[cgp_auto_getter], allowing them to support more general getter interfaces to be defined. Specializ...

A lot of new features have been added to the `#[cgp_getter]` macro! For the basic use cases, you can now define getter methods that return &str or Option<&T>, and the macro will generate getter implementations that read from String or Option<T> fields.

github.com/contextgener...

23.03.2025 16:45 πŸ‘ 0 πŸ” 1 πŸ’¬ 1 πŸ“Œ 0
On the State of Coherence in the Land of Type Classes Type classes are a popular tool for implementing generic algorithms and data structures without loss of efficiency, bridging the gap between parametric and ad-hoc polymorphism. Since their initial dev...

Here is the original article: programming-journal.org/2025/10/15/

12.03.2025 10:27 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Shameless plug: I am working on a solution in Rust that solves the coherence pro... | Hacker News

A great article that gives an overview of the coherence problem in typeclasses/traits has been surfaced on Hacker News. I am trying to take the opportunity to pitch about CGP and how it helps solve the given coherence problems.

Help give me an upvote here: news.ycombinator.com/item?id=4334...

12.03.2025 10:27 πŸ‘ 2 πŸ” 1 πŸ’¬ 1 πŸ“Œ 0

We are in the progress of writing a full blog post detailing all new features, as well as updating the CGP Patterns book to include the new features. Hopefully this will all be done in a few more weekends!

09.03.2025 21:46 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Post image

CGP now has a new logo! The website has been updated with the new logo and color theme: contextgeneric.dev

There are many exciting features in the upcoming v0.4.0 release. In particular, CGP now shows much more informative compile errors that makes it much easier to debug CGP code.

09.03.2025 21:46 πŸ‘ 1 πŸ” 2 πŸ’¬ 1 πŸ“Œ 0