Skip to content

Commit 906c80c

Browse files
committed
Fix markdown headings to get anchor links
1 parent 82fb2c6 commit 906c80c

15 files changed

Lines changed: 397 additions & 396 deletions

blog/2024-12-19-early-preview-announcement.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ to introduce a new modular programming paradigm for Rust.
1010

1111
<!-- truncate -->
1212

13-
# A Quick Overview of Context-Generic Programming
13+
## A Quick Overview of Context-Generic Programming
1414

1515
As its name implied, CGP makes it possible to write _context-generic_ programs that can work
1616
with any context type in Rust, i.e. the type that we typically refer to as `Self`.
@@ -42,7 +42,7 @@ If you are new here, you should check out the [CGP homepage](/) for a proper int
4242
Instead of rehearsing the full introduction, this blog post will cover some background about the
4343
project, the current status, and what to expect from here on.
4444

45-
# How It All Started
45+
## How It All Started
4646

4747
My name is [Soares Chen](https://maybevoid.com/soareschen), a.k.a. [MaybeVoid](https://maybevoid.com),
4848
and I am the creator of CGP. Even though this project is still new to the public, it has been ongoing
@@ -77,7 +77,7 @@ Compared to my previous attempts, I am hopeful that Rust serves as a sweetspot t
7777
programming language for modular design patterns, thanks to its advanced type systems as well as
7878
its rapidly expanding ecosystem.
7979

80-
# Current Status
80+
## Current Status
8181

8282
This blog post serves as an early preview announcement, and kickstarts many efforts that are
8383
still needed before we can be ready for a full release.
@@ -97,13 +97,13 @@ Depending on my time availability, it may take a year or more before I am ready
9797
of CGP. But in the meanwhile, I will start posting regular updates on my development process,
9898
which may be of interest for some of you reading this blog post.
9999

100-
# Plans for 2025
100+
## Plans for 2025
101101

102102
In the upcoming new year 2025, I have many plans laid out to prepare for an official release of
103103
CGP. This section is less about making promises, but more about making you aware of how much work
104104
is still needed before you should consider using CGP seriously.
105105

106-
## Finish the CGP Book
106+
### Finish the CGP Book
107107

108108
The most important goal I have for CGP is to finish writing my first book,
109109
[Context-Generic Programming Patterns](https://patterns.contextgeneric.dev).
@@ -112,7 +112,7 @@ My hope is that the book will help reduce the bus factor of CGP, so that even if
112112
unavailable to continue working on CGP, someone could still use the book as a basis
113113
to continue the work.
114114

115-
## Improve Error Diagnostics
115+
### Improve Error Diagnostics
116116

117117
A critical blocker that makes it challenging for me to teach about CGP is the poor error
118118
reporting returned from the Rust compiler, when there is any error arise from unsatisfied constraints.
@@ -137,7 +137,7 @@ The progress on improving the error messages is tracked on CGP's GitHub issue
137137
the forked compiler is documented in the
138138
[CGP book](https://patterns.contextgeneric.dev/debugging-techniques.html#improving-the-compiler-error-message).
139139

140-
## Document the `cgp` Crate
140+
### Document the `cgp` Crate
141141

142142
I have done quite a bit of writing about CGP on the project website and the book. But if you
143143
look at the Cargo documentation for the [`cgp` crate](https://docs.rs/cgp/), you would see
@@ -151,7 +151,7 @@ about relevant concepts.
151151
That said, I do plan to provide at least minimal documentation inside the `cgp` crate,
152152
to help onboarding programmers to projects that use the `cgp` crate.
153153

154-
## Public Speaking
154+
### Public Speaking
155155

156156
An effective way to spread the awareness of CGP is for me to speak about it at Rust conferences.
157157
I plan to apply to speak at major Rust conferences located in Europe, and hopefully I will get
@@ -163,7 +163,7 @@ by organizing online meetups. However, this would subject to my time availabilit
163163
from the community, as producing tech videos is not exactly my area of expertise.
164164
But in case if you are interested in such content, do let me know what you would like to see produced.
165165

166-
## Improve the CGP Macros
166+
### Improve the CGP Macros
167167

168168
The proc macros provided by the `cgp` crate were written in haste as quick proof of concepts
169169
to simplify the syntax for writing CGP programs. As a result, they are not that high in quality,
@@ -179,7 +179,7 @@ When I have the time, I plan to learn more about how to properly implement the p
179179
and implement them correctly with proper test coverage. This is important to provide good
180180
user experience, as developers will use the macros all the time when programming in CGP.
181181

182-
## Developer Tooling
182+
### Developer Tooling
183183

184184
For CGP to gain mainstream adoption, it is not sufficient to just make CGP powerful enough
185185
to solve difficult programming problems. In addition to that, we also need to make CGP
@@ -202,7 +202,7 @@ the cognitive burden of wiring CGP components can be automated by the IDE. But i
202202
much longer than one year for me to implement such features. In the meanwhile, I will probably
203203
explore on simpler options, such as building simple CLI tools for CGP.
204204

205-
## Implement Advanced CGP features
205+
### Implement Advanced CGP features
206206

207207
Aside from improving CGP macros, there are a few more advanced core constructs that I need to
208208
implement in the `cgp` crate to enable CGP to solve more use cases.
@@ -217,7 +217,7 @@ In case if you have interest in topics such as row polymorphism, datatype-generi
217217
and category theory, you might be interested to follow my progress on how I make use of these
218218
advanced concepts in CGP.
219219

220-
## More Documentation
220+
### More Documentation
221221

222222
It would be a big milestone if I am able to finish the first CGP book and document the `cgp`
223223
crate by the end of 2025. But I also hope to write more documentation in other forms, to
@@ -241,10 +241,10 @@ problem that you think CGP may help solving, I would love to hear more about it.
241241
This can help inform me what kind of topics is popular, and allows me to better
242242
prepared to produce content for those topics.
243243

244-
# How You Can Help
244+
## How You Can Help
245245

246246
If you have read till the end of this blog post, thank you for taking your time!
247-
If you are interested in CGP, the project homepage [lists many ways](/#contribution)
247+
If you are interested in CGP, the project homepage [lists many ways](/docs/contribute)
248248
you can help me continue my development on CGP.
249249
I look forward to see you again in the future updates for CGP!
250250

blog/2025-01-09-v0.3.0-release.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,33 @@ I'm excited to announce the release of [v0.3.0](https://github.com/contextgeneri
99

1010
<!-- truncate -->
1111

12-
# New Book Chapters
12+
## New Book Chapters
1313

1414
We’ve added a few new chapters to the [CGP Patterns](https://patterns.contextgeneric.dev/) book. Below is a brief summary of the newly published content.
1515

16-
## Associated Types
16+
### Associated Types
1717

1818
In the [launch announcement](/blog/early-preview-announcement/) for CGP, some readers remarked that CGP seemed to be primarily a dependency injection framework in Rust. While this observation captured part of its functionality, a key feature not yet covered was CGP's ability to use _abstract types_ in conjunction with the dependency injection of _types_.
1919

2020
In the [new chapter](https://patterns.contextgeneric.dev/associated-types.html) of the book, we explore this powerful feature with a motivating example: implementing a context-generic authentication token validator that is not only generic over the `Context` but also over abstract `Time` and `AuthToken` types. The chapter also demonstrates how to use the `cgp_type!` macro to streamline the declaration of abstract type traits and how to employ `UseType` in component wiring to instantiate abstract types.
2121

22-
## Error Handling
22+
### Error Handling
2323

2424
CGP introduces a novel approach to error handling that differs significantly from the conventional patterns used in Rust today. In the [new chapter](https://patterns.contextgeneric.dev/error-handling.html) of the book, we begin by leveraging an abstract `Error` type from `HasErrorType` to define error-returning method signatures. The chapter then delves into how `CanRaiseError` and `CanWrapError` can be used to produce abstract errors within context-generic provider implementations. Further, the chapter discusses how to define context-generic error raisers and leverage the `UseDelegate` pattern for static dispatching of error handling to various providers.
2525

26-
## Field Accessors
26+
### Field Accessors
2727

2828
CGP provides a robust mechanism for dependency injection using [impl-side dependencies](https://patterns.contextgeneric.dev/impl-side-dependencies.html). However, since these dependencies are expressed through traits and constraints, we need to define _accessor traits_ to retrieve field values from a generic context.
2929

3030
In the [new chapter](https://patterns.contextgeneric.dev/field-accessors.html), we explore different approaches for defining, using, and implementing accessor traits in CGP. This chapter explains how the `#[derive(HasField)]` macro operates and dives into the internal workings of `HasField` and `Symbol!`. It also introduces the` #[cgp_auto_getter]` and `#[cgp_getter]` macros, which automatically generate accessor provider implementations that work with `HasField`.
3131

32-
# `cgp` v0.3.0 Release
32+
## `cgp` v0.3.0 Release
3333

34-
The `cgp` crate has been upgraded from `v0.2.0` to `v0.3.0`, introducing new features that significantly enhance usability and include minor breaking changes. You can view the full [release notes here](https://github.com/contextgeneric/cgp/releases/tag/v0.3.0). Additionally, the [Hello World example](/#hello-world-example) on the project homepage has been updated to showcase a simplified implementation using the latest CGP constructs.
34+
The `cgp` crate has been upgraded from `v0.2.0` to `v0.3.0`, introducing new features that significantly enhance usability and include minor breaking changes. You can view the full [release notes here](https://github.com/contextgeneric/cgp/releases/tag/v0.3.0). Additionally, the [Hello World example](/docs/tutorials/hello) on the project homepage has been updated to showcase a simplified implementation using the latest CGP constructs.
3535

3636
Below is a summary of key updates in this release.
3737

38-
## `cgp_type!` Macro
38+
### `cgp_type!` Macro
3939

4040
The new `cgp_type!` macro streamlines the process of declaring abstract type traits, enabling you to define them in a single line of code. For instance, the `HasErrorType` trait in `cgp` is now defined as:
4141

@@ -64,7 +64,7 @@ where
6464

6565
For a detailed explanation of cgp_type! and its usage, check out the new [Associated Types](https://patterns.contextgeneric.dev/associated-types.html#defining-abstract-type-traits-with-cgp_type) chapter in the CGP Patterns book.
6666

67-
## `#[cgp_auto_getter]` Macro
67+
### `#[cgp_auto_getter]` Macro
6868

6969
The `#[cgp_auto_getter]` macro simplifies the process of defining accessor traits with blanket implementations based on `HasField`. When a trait is marked with `#[cgp_auto_getter]`, any context deriving `HasField` that has the required fields and types will automatically implement the specified trait without additional boilerplate.
7070

@@ -96,7 +96,7 @@ In this example, the `Person` struct derives the `HasField` trait, which automat
9696

9797
For more details on `#[cgp_auto_getter]`, refer to the [Generic Accessor Providers](https://patterns.contextgeneric.dev/generic-accessor-providers.html#the-cgp_auto_getter-macro) chapter in the CGP Patterns book.
9898

99-
## `#[cgp_getter]` Macro
99+
### `#[cgp_getter]` Macro
100100

101101
The `#[cgp_getter]` macro, like `#[cgp_auto_getter]`, generates blanket implementations that make use of `HasField`. However, `#[cgp_getter]` extends functionality by also creating full CGP constructs for the trait, similar to `#[cgp_component]`. This requires explicit wiring in the context using `delegate_components!`. Additionally, `#[cgp_getter]` derives a blanket implementation for the `UseFields` provider, so that it can be used inside the component wiring as follows:
102102

@@ -138,7 +138,7 @@ fn main() {
138138

139139
For additional information on `#[cgp_getter]`, refer to the [Generic Accessor Providers](https://patterns.contextgeneric.dev/generic-accessor-providers.html#the-cgp_getter-macro) chapter of the CGP Patterns book.
140140

141-
## `CanWrapError` Trait
141+
### `CanWrapError` Trait
142142

143143
The `CanWrapError` trait has been introduced to streamline the process of wrapping existing errors. Its definition is as follows:
144144

@@ -155,13 +155,13 @@ Previously, error wrapping relied on using `CanRaiseError` with a tuple, such as
155155

156156
For more details about the usage of `CanWrapError`, refer to the [Error Wrapping](https://patterns.contextgeneric.dev/error-wrapping.html) chapter in the CGP Patterns book.
157157

158-
## `cgp-error-anyhow` Crate
158+
### `cgp-error-anyhow` Crate
159159

160160
We have published a new [`cgp-error-anyhow`](https://docs.rs/cgp-error-anyhow/0.3.0/cgp_error_anyhow/index.html) crate, which provides context-generic error raisers for `anyhow::Error`. This addition complements the previously published [`cgp-error-eyre`](https://docs.rs/cgp-error-eyre/0.3.0/cgp_error_eyre/index.html) and [`cgp-error-std`](https://docs.rs/cgp-error-std/0.3.0/cgp_error_std/index.html) crates, which support CGP error handling with `eyre::Error` and `Box<dyn core::error::Error + Send + Sync + 'static>`. Given the popularity of `anyhow::Error`, this crate extends support for its usage.
161161

162162
Details on using `cgp-error-anyhow` for error handling can be found in the [Error Handling](https://patterns.contextgeneric.dev/error-handling.html#the-cgp-error-anyhow-crate) chapter of the CGP Patterns book.
163163

164-
## `cgp-runtime` Crate
164+
### `cgp-runtime` Crate
165165

166166
The new [`cgp-runtime`](https://docs.rs/cgp-runtime/0.3.0/cgp_runtime/index.html) crate introduces standardized interfaces for runtimes, paving the way for future discussions on asynchronous programming in the CGP Patterns book.
167167

@@ -180,23 +180,23 @@ pub trait HasRuntime: HasRuntimeType {
180180

181181
Stay tuned for updates to the CGP Patterns book for more information on using pluggable async runtimes with CGP.
182182

183-
# Future Work
183+
## Future Work
184184

185185
There are several additional features and improvements I had hoped to include in this update. However, with my New Year vacation coming to an end, I need to wrap up the current progress. Below are some of the tasks deferred to future updates.
186186

187-
## Documenting the `cgp` Crate
187+
### Documenting the `cgp` Crate
188188

189189
While the CGP Patterns book offers extensive conceptual coverage, the `cgp` crate currently lacks comprehensive Rustdoc documentation. Many constructs remain undocumented, and users must rely on the CGP Patterns book or this website for detailed guidance.
190190

191191
In future updates, I plan to add concise Rustdoc comments to these constructs and include links to relevant chapters in the CGP Patterns book. This will help bridge the gap and provide in-crate documentation to enhance usability. For now, all detailed information about CGP is accessible only through the book and website.
192192

193-
## Tutorials with More Complex Use Cases
193+
### Tutorials with More Complex Use Cases
194194

195195
During the [launch announcement](/blog/early-preview-announcement/), many readers noted the lack of practical examples demonstrating how CGP can address more complex, real-world problems. While I had planned to create such tutorials, much of my time was spent completing relevant chapters and updating the `cgp` crate. I ask for your patience as I work on delivering concise, compelling examples to better illustrate CGP's utility.
196196

197197
In the meantime, the simplified examples in the recently added [Associated Types](https://patterns.contextgeneric.dev/associated-types.html), [Error Handling](https://patterns.contextgeneric.dev/error-handling.html), and [Field Accessors](https://patterns.contextgeneric.dev/field-accessors.html) chapters provide a glimpse into CGP's practical applications. These include examples like validating whether an authentication token has expired and making HTTP API calls to fetch messages. While not exhaustive, these examples go beyond the basic "Hello World" tutorial on the homepage and offer a clearer picture of how CGP can be applied to your projects.
198198

199-
# Acknowledgement
199+
## Acknowledgement
200200

201201
A big thank you to [@marvin-hansen](https://github.com/marvin-hansen) for his enthusiastic involvement in discussions, testing CGP with real-world projects, and providing invaluable feedback! The implementation of the `#[cgp_getter]` and `#[cgp_auto_getter]` macros was primarily motivated by his input, highlighting that the direct use of `HasField` could be too complex for beginners. Thanks to his suggestions, CGP now offers a more seamless and intuitive experience for declaring and using field accessor traits.
202202

0 commit comments

Comments
 (0)