You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/blog/2025-05-08-v0.4.0-release.md
+54-1Lines changed: 54 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -516,4 +516,57 @@ The preset inheritance works very similarly to how inheritance is typically unde
516
516
517
517
First of all, presets only work as type-level lookup tables, with no ability to directly implement "methods" on the preset itself. Hence, it works more like protoypal inheritance in languages such as JavaScript. Furthermore, the lookup table only exists at the type level, meaning that it does not exist at runtime, and thus does not introduce any runtime overhead.
518
518
519
-
More importantly, CGP and Rust do not support the notion of subtyping. This means that two contexts that "inherit" from the same preset are treated as completely distinct types, and there is no mechanism to "upcast" the values to a common preset "parent type", which does not exist. This means that in constrast to OOP, CGP inheritance only exist at the "provider"-side for implementations, but not on the "consumer"-side for polymorphic consumption.
519
+
More importantly, CGP and Rust do not support the notion of subtyping. This means that two contexts that "inherit" from the same preset are treated as completely distinct types, and there is no mechanism to "upcast" the values to a common preset "parent type", which does not exist. This means that in constrast to OOP, CGP inheritance only exist at the "provider"-side for implementations, but not on the "consumer"-side for polymorphic consumption.
520
+
521
+
## `Async` Trait Update
522
+
523
+
The `Async` trait was defined to be a trait alias to `Send + Sync + 'static`, to make it more easy for users to define abstract types that can be used within async functions that return `impl Future + Send`. However, practical experience has shown that the `'static` bound is not really needed in most cases, and thus removed by [#89](https://github.com/contextgeneric/cgp/pull/89) from the default recommended trait bound.
524
+
525
+
The removal of `'static` will make it easier to instantiate abstract types with concrete types that do not contain `'static` trait bound. On the other hand, the default inclusion of `Send + Sync` is almost a necessary evil with the current state of async Rust. However, this may soon change when Return Type Notation (RTN) gets stabilized in Rust in the near future in [rust#138424](https://github.com/rust-lang/rust/pull/138424). Once that is stabilized, the `Async` trait itself can entirely be deprecated or removed.
526
+
527
+
## `#[blanket_trait]` Macro
528
+
529
+
[#79](https://github.com/contextgeneric/cgp/pull/79) and [#82](https://github.com/contextgeneric/cgp/pull/82) introduces a new `#[blanket_trait]` macro, which can be used to define trait aliases that contain empty body and trivial blanket implementations.
530
+
531
+
Developers can use the `#[blanket_trait]` macro to define trait aliases, as well as abstract type aliases for more advanced cases. For example, given the following:
would result in the following blanket implementation to be automatically generated:
539
+
540
+
```rust
541
+
impl<Context> HasAsyncErrorTypeforContext
542
+
where
543
+
Context:Async+HasErrorType<Error:Async> {}
544
+
```
545
+
546
+
## Personal Updates
547
+
548
+
Aside from all the feature updates, I also have some personal updates related to the development of CGP.
549
+
550
+
### Persentation at Leipzig Rust Meetup
551
+
552
+
I have given a presentation of CGP at the [Leipzig Rust meetup](https://www.meetup.com/rust-modern-systems-programming-in-leipzig/events/303729528/) in February. Although there were no video recording, you can check out the [presentation slides](https://github.com/contextgeneric/cgp-presentations/blob/main/2025/cgp-leipzig-2025-02-18.pdf) if you are interested.
553
+
554
+
### Bank Transfer Example
555
+
556
+
Along with the meetup presentation, an example [bank transfer](https://github.com/contextgeneric/cgp-examples/tree/main/transfer) application has been drafted to demonstrate the use of CGP in practical applications. The example code is not yet sufficiently documented, but hopefully it can serve as a sneak preview for readers who would like to see more complex examples of CGP programs.
557
+
558
+
### More Active Development
559
+
560
+
It has been 4 months since our last update. It was proven to be challenging to manage a side project, while also juggling with a full time job plus child care without support from the grandparents. On the bright side, I have managed to get a short 3-month sabbatical from May to July, before changing to a new job.
561
+
562
+
During the next 3 months, you can expect to see much more active development from me to push CGP towards wider adoption. If you have suggestions on what should be developed during this time, or how I can make the project more sustainable, do let me know in the comments.
563
+
564
+
### Attending RustWeek
565
+
566
+
I will be attending [RustWeek](https://rustweek.org/) in person next week (May 13-17 2025). Although I did not manage to get a presentation slot, I would love to meet up with Rust developers and discuss about how CGP can be used to solve real world problem in their Rust applications.
567
+
568
+
If there are interests, I would also like to organize [Hackathon](https://rustweek.org/events/hackathon/) sessions during the last day to have coding sessions for CGP. Otherwise, I might look around and try to apply CGP on one of the Hackathon projects. If you have any suggestions, do let me know.
569
+
570
+
Lastly, if you read until this point and is attending RustWeek, do ping me on [BlueSky](https://bsky.app/profile/maybevoid.com) and I would love to chat with you.
571
+
572
+
Thank you for reading, and stay tuned for more updates on CGP!
0 commit comments