Skip to content

Commit 851ce28

Browse files
authored
Merge pull request #12 from contextgeneric/cgp-serde-release
Publish `cgp-serde` release blog post
2 parents f757331 + 725e68d commit 851ce28

File tree

4 files changed

+941
-18
lines changed

4 files changed

+941
-18
lines changed

content/_index.md

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,78 @@ sort_by = "weight"
1010

1111
# Announcement
1212

13-
I’m excited to announce the release of [**CGP v0.6.0**](/blog/v0-6-0-release/)!
14-
This version introduces major ergonomic improvements that make provider and context implementations simpler and more intuitive to write.
13+
I am excited to announce the release of [**cgp-serde**](/blog/cgp-serde-release/), a modular serialization library for Serde that leverages the power of [**Context-Generic Programming**](/).
1514

16-
The new `#[cgp_impl]` and `#[cgp_inherit]` macros replace `#[cgp_provider]` and `#[cgp_context]`, offering cleaner syntax and greatly improving the readability of CGP code.
15+
[Read the announcement blog post](/blog/cgp-serde-release/) to find out more.
1716

18-
[Read the announcement blog post](/blog/v0-6-0-release/) to find out more.
17+
---
1918

20-
# Overview
19+
# Quick Introduction
2120

22-
Context-generic programming (CGP) is a new programming paradigm for Rust that allows strongly-typed components to be implemented and composed in a modular, generic, and type-safe way.
21+
Context-Generic Programming (CGP) is a modular programming paradigm that enables you to bypass the **coherence restrictions** in Rust traits, allowing for **overlapping** and **orphan** implementations of any CGP trait.
2322

24-
To learn more about the high level overview of CGP, check out the [overview](/overview) page.
23+
You can adapt almost any existing Rust trait to use CGP today by applying the `#[cgp_component]` macro to the trait definition. After this annotation, you can write **named** implementations of the trait using `#[cgp_impl]`, which can be defined without being constrained by the coherence rules. You can then selectively enable and reuse the named implementation for your type using the `delegate_components!` macro.
24+
25+
For instance, we can, in principle, annotate the standard library’s [`Hash`]([https://doc.rust-lang.org/std/hash/trait.Hash.html]\(https://doc.rust-lang.org/std/hash/trait.Hash.html\)) trait with `#[cgp_component]` like this:
26+
27+
```rust
28+
#[cgp_component(HashProvider)]
29+
pub trait Hash { ... }
30+
```
31+
32+
This change does not affect existing code that uses or implements `Hash`, but it allows for new, potentially overlapping implementations, such as one that works for any type that also implements `Display`:
33+
34+
```rust
35+
#[cgp_impl(HashWithDisplay)]
36+
impl<T: Display> HashProvider for T { ... }
37+
```
38+
39+
You can then apply and reuse this implementation on any type by using the `delegate_components!` macro:
40+
41+
```rust
42+
pub struct MyData { ... }
43+
impl Display for MyData { ... }
44+
45+
delegate_components! {
46+
MyData {
47+
HashProviderComponent: HashWithDisplay,
48+
}
49+
}
50+
```
51+
52+
In this example, `MyData` implements the `Hash` trait by using `delegate_components!` to delegate its implementation to the `HashWithDisplay` provider, identified by the key `HashProviderComponent`. Because `MyData` already implements `Display`, the `Hash` trait is now automatically implemented through CGP via this delegation.
53+
54+
---
2555

2656
# Current Status
2757

28-
As of 2025, CGP remains in its _early stages_ of development. While promising, it still has several rough edges, particularly in areas such as documentation, tooling, debugging techniques, community support, and ecosystem maturity.
58+
As of 2025, it is important to note that CGP remains in its **formative, early stages** of active development. While the potential is genuinely promising, it still has several inevitable rough edges, particularly in key areas such as comprehensive documentation, mature tooling, streamlined debugging techniques, robust community support, and overall ecosystem maturity.
2959

30-
As such, adopting CGP for serious projects comes with inherent challenges, and users are advised to proceed _at their own risk_. The primary risk is not technical but stems from the limited support available when encountering difficulties in learning or applying CGP.
60+
Consequently, embracing CGP for your mission-critical, serious projects comes with inherent challenges, and you should be advised to proceed **at your own discretion and risk**. The primary risk you face is not strictly technical, but rather stems from the current limited support available when you inevitably encounter difficulties while learning or attempting to apply CGP in production.
3161

32-
At this stage, CGP is best suited for early adopters and potential [contributors](/overview/#contribution) who are willing to experiment and help shape its future.
62+
At this pioneering stage, CGP is an ideal fit for [**early adopters and enthusiastic potential contributors**](/contribute/) who are eager to experiment with the paradigm and actively help to shape its powerful future.
63+
64+
---
3365

3466
# Getting Started
3567

36-
There are several places where you can get started learning and using CGP.
68+
Even though the CGP project is officially still less than one year old, some of the initial documentation and resources you might find have already become slightly outdated, or they have been gracefully superseded by more intuitive and modern patterns. Nevertheless, this section is an attempt to provide you with the very best and most current guidance on how you can effectively begin to learn more about CGP.
69+
70+
## Blog Posts
71+
72+
The most accurate and up-to-date resources concerning CGP are currently available in the form of our insightful [blog posts](/blog). Specifically, we recommend that the blog posts starting from the [**v0.6.0 release onward**](/blog/v0-6-0-release/) will give you a significantly more concise and modern explanation of precisely what CGP is all about.
3773

3874
## Hello World Tutorial
3975

40-
The [Hello World Tutorial](/tutorials/hello) gives a high level walkthrough of various CGP features using a hello-world style example.
76+
The hands-on [Hello World Tutorial](/tutorials/hello) provides a high-level and clear walkthrough of various fundamental CGP features by using a familiar, simple hello-world style example.
4177

4278
## Book
4379

44-
To better understand CGP, the best approach is to dive into our book, [Context-Generic Programming Patterns](https://patterns.contextgeneric.dev/). It provides a comprehensive guide to understanding and working with CGP.
4580

46-
## Applications
81+
If your preference is to rigorously understand CGP from its **first principles**, without relying on the specific implementations within the [`cgp` crate](https://github.com/contextgeneric/cgp), your best approach is to dive into our comprehensive book, [Context-Generic Programming Patterns](https://patterns.contextgeneric.dev/). This resource provides a deep, thorough guide to understanding the complex inner workings of CGP.
4782

48-
You can also explore real-world applications and projects that use CGP, such as [Hermes SDK](https://github.com/informalsystems/hermes-sdk/), to gain a deeper understanding of its practical uses.
83+
Please note that this book has not been updated for a while, and you might consider skipping the book entirely if your primary goal is to start using CGP quickly with the absolute minimal learning curve!
4984

5085
## Resources
5186

52-
Check out the [Resources](/resources) page for more materials and learning tools to help you get up to speed with CGP.
87+
Make sure to check out the dedicated [Resources](/resources) page, which contains more supplementary materials and various learning tools to help you get up to speed with CGP.

0 commit comments

Comments
 (0)