Skip to content

Commit 4cd9df1

Browse files
author
GitHub Actions
committed
Deploy contextgeneric/contextgeneric.dev to contextgeneric/contextgeneric.dev:gh-pages
0 parents  commit 4cd9df1

File tree

14 files changed

+855
-0
lines changed

14 files changed

+855
-0
lines changed

.nojekyll

Whitespace-only changes.

404.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<!doctype html>
2+
<title>404 Not Found</title>
3+
<h1>404 Not Found</h1>

CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
contextgeneric.dev

carbon.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

elasticlunr.min.js

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

favicon.png

1.09 KB
Loading

index.html

Lines changed: 307 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,307 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<title>Context-Generic Programming</title>
7+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
8+
9+
<link rel="icon" type="image/png" href="/favicon.png" />
10+
11+
<style>
12+
:root {
13+
/* Primary theme color */
14+
--primary-color: #f7e5c6;
15+
/* Primary theme text color */
16+
/* --primary-text-color: #543631; */
17+
--primary-text-color: #000;
18+
--primary-text-color-over: #000;
19+
/* Primary theme link color */
20+
--primary-link-color: #e19a1e;
21+
/* Secondary color: the background body color */
22+
--secondary-color: #fcfaf6;
23+
--secondary-text-color: #303030;
24+
/* Highlight text color of table of content */
25+
--toc-highlight-text-color: #c27e08;
26+
--toc-background-color: white;
27+
--code-color: #4a4a4a;
28+
--code-background-color: white;
29+
--shadow-color: #ddd;
30+
/* Font used for headers (h1 & h2) */
31+
--header-font-family: "Fira Sans", sans-serif;
32+
/* Font used for text */
33+
--text-font-family: "Fira Sans", sans-serif;
34+
}
35+
</style>
36+
37+
<link href="https://fonts.googleapis.com/css?family=Alfa+Slab+One&display=swap" rel="stylesheet">
38+
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600&display=swap" rel="stylesheet">
39+
40+
<link rel="stylesheet" href="/normalize.css">
41+
<link rel="stylesheet" href="https://contextgeneric.dev/juice.css">
42+
43+
<link rel="stylesheet" href="https://contextgeneric.dev/carbon.css">
44+
45+
</head>
46+
47+
<body>
48+
49+
50+
<header class="pos-absolute" style="background-color: transparent">
51+
52+
53+
<a href="https://contextgeneric.dev/">
54+
<div class="logo">
55+
<img src="https://contextgeneric.dev/rust-logo.svg" alt="logo">
56+
Context-Generic Programming
57+
</div>
58+
</a>
59+
60+
<nav>
61+
62+
63+
64+
<a class="nav-item subtitle-text" href="https://contextgeneric.dev/resources/">Resources</a>
65+
66+
67+
68+
69+
<a class="nav-item subtitle-text" href="https://patterns.contextgeneric.dev">Book</a>
70+
71+
<a class="nav-item subtitle-text" href="https://github.com/contextgeneric">GitHub</a>
72+
73+
74+
</nav>
75+
76+
</header>
77+
78+
<div class="hero">
79+
80+
<section class="text-center">
81+
<h1 class="heading-text" style="font-size: 40px">
82+
A new programming paradigm for Rust
83+
</h1>
84+
<h3 class="title-text">
85+
<span style="color: rgb(8, 155, 8)"></span> <i>Modular</i> component system
86+
</h3>
87+
<h3 class="title-text">
88+
<span style="color: rgb(8, 155, 8)"></span> <i>Expressive</i> ways to write code
89+
</h3>
90+
<h3 class="title-text">
91+
<span style="color: rgb(8, 155, 8)"></span> <i>Type-Safe</i> composition
92+
</h3>
93+
<h3 class="title-text">
94+
<span style="color: rgb(8, 155, 8)"></span> <i>No-Std</i> friendly
95+
</h3>
96+
<h3 class="title-text">
97+
<span style="color: rgb(8, 155, 8)"></span> <i>Zero-Cost</i> abstraction
98+
</h3>
99+
</section>
100+
<img class="hero-image" style="width: 50%" src="/rust-logo.svg">
101+
102+
<div class="explore-more text"
103+
onclick="document.getElementById('features').scrollIntoView({behavior: 'smooth'})">
104+
Explore More ⇩
105+
</div>
106+
<style>
107+
.hero section {
108+
padding: 0 5rem;
109+
}
110+
111+
@media screen and (max-width: 768px) {
112+
.hero section {
113+
padding: 0 2rem;
114+
}
115+
116+
.hero-image {
117+
display: none
118+
}
119+
}
120+
</style>
121+
122+
</div>
123+
124+
125+
126+
<main>
127+
128+
129+
130+
131+
132+
<div class="toc">
133+
<div class="toc-sticky">
134+
135+
<div class="toc-item">
136+
<a class="subtext" href="https://contextgeneric.dev/#introduction">Introduction</a>
137+
</div>
138+
139+
140+
<div class="toc-item-child">
141+
<a class="subtext" href="https://contextgeneric.dev/#modular-component-system"><small>- Modular Component System</small></a>
142+
</div>
143+
144+
<div class="toc-item-child">
145+
<a class="subtext" href="https://contextgeneric.dev/#expressive-ways-to-write-code"><small>- Expressive Ways to Write Code</small></a>
146+
</div>
147+
148+
<div class="toc-item-child">
149+
<a class="subtext" href="https://contextgeneric.dev/#type-safe-composition"><small>- Type-Safe Composition</small></a>
150+
</div>
151+
152+
<div class="toc-item-child">
153+
<a class="subtext" href="https://contextgeneric.dev/#no-std-friendly"><small>- No-Std Friendly</small></a>
154+
</div>
155+
156+
<div class="toc-item-child">
157+
<a class="subtext" href="https://contextgeneric.dev/#zero-cost-abstraction"><small>- Zero-Cost Abstraction</small></a>
158+
</div>
159+
160+
161+
162+
<div class="toc-item">
163+
<a class="subtext" href="https://contextgeneric.dev/#current-status">Current Status</a>
164+
</div>
165+
166+
167+
<div class="toc-item">
168+
<a class="subtext" href="https://contextgeneric.dev/#getting-started">Getting Started</a>
169+
</div>
170+
171+
172+
<div class="toc-item">
173+
<a class="subtext" href="https://contextgeneric.dev/#contribution">Contribution</a>
174+
</div>
175+
176+
177+
<div class="toc-item">
178+
<a class="subtext" href="https://contextgeneric.dev/#acknowledgement">Acknowledgement</a>
179+
</div>
180+
181+
182+
</div>
183+
</div>
184+
185+
186+
187+
<div class="content text">
188+
189+
<div id="features" class="heading-text">Overview</div>
190+
<h1 id="introduction">Introduction</h1>
191+
<p>Context-generic programming (CGP) is a new programming paradigm for Rust that
192+
allows strongly-typed components to be implemented and composed in a modular,
193+
generic, and type-safe way.</p>
194+
<h2 id="modular-component-system">Modular Component System</h2>
195+
<p>CGP makes use of Rust's trait system to define generic component <em>interfaces</em>
196+
that decouple code that <em>consumes</em> an interface from code that <em>implements</em> an interface.
197+
This is done by having <em>provider traits</em> that are used for implementing a
198+
component interface, in addition to <em>consumer traits</em> which are used for
199+
consuming a component interface.</p>
200+
<p>The separation of provider traits from consumer traits allows multiple context-generic
201+
provider implementations to be defined, bypassing Rust's trait system original restriction
202+
of forbidding overlapping implementations.</p>
203+
<h2 id="expressive-ways-to-write-code">Expressive Ways to Write Code</h2>
204+
<p>With CGP, one can easily write <em>abstract programs</em> that is generic over
205+
a context, together with all its associated types and methods. CGP allows such
206+
generic code to be written without needing to explicitly specify a long list
207+
generic parameters in the type signatures.</p>
208+
<p>CGP also provides powerful <em>macros</em> for defining component interfaces, as well
209+
as providing simple ways to wire up component implementations to be used with
210+
a concrete context.</p>
211+
<p>CGP allows Rust code to be written with the same level of expressiveness,
212+
if not more, as other popular programming paradigms, including object-oriented programming
213+
and dynamic-typed programming.</p>
214+
<h2 id="type-safe-composition">Type-Safe Composition</h2>
215+
<p>CGP makes use of Rust's strong type system to help ensure that all wiring
216+
of components is <em>type-safe</em>, catching any missing dependencies as compile-time
217+
errors. CGP works fully within safe Rust, and does not make use of
218+
any dynamic-typing techniques, e.g. <code>dyn</code> traits, <code>Any</code>, or reflection.
219+
As a result, developers can ensure that no CGP-specific errors can happen
220+
during application runtime.</p>
221+
<h2 id="no-std-friendly">No-Std Friendly</h2>
222+
<p>CGP makes it possible to build <em>fully-abstract programs</em> that can be defined
223+
with <em>zero dependencies</em>. This allows such programs to be instantiated with
224+
specialized-dependencies in no-std environments, such as on embedded systems,
225+
operating system kernels, or Wasm sandboxes.</p>
226+
<h2 id="zero-cost-abstraction">Zero-Cost Abstraction</h2>
227+
<p>Since all CGP features work only at compile-time, it provides the same
228+
<em>zero-cost abstraction</em> advantage as Rust. Applications do not have to sacrifice
229+
any runtime overhead for using CGP in the code base.</p>
230+
<h1 id="current-status">Current Status</h1>
231+
<p>As of end of 2024, CGP is still in <em>early-stage</em> development, with many
232+
rough edges in terms of documentation, tooling, debugging techniques,
233+
community support, and ecosystem.</p>
234+
<p>As a result, you are advised to proceed <em>at your own risk</em> on using CGP in
235+
any serious project. Note that the current risk of CGP is <em>not</em> technical,
236+
but rather the limited support you may get when encoutering any challenge
237+
or difficulty in learning or using CGP.</p>
238+
<p>Currently, the target audience for CGP are primarily early adopters and
239+
<a href="https://contextgeneric.dev/#contribution">contributors</a>, preferrably with strong background in
240+
<em>functional programming</em>.</p>
241+
<h1 id="getting-started">Getting Started</h1>
242+
<p>The best way to get started is to start reading the book
243+
<a href="https://patterns.contextgeneric.dev/">Context-Generic Programming Patterns</a>.
244+
You can also learn about how CGP works by looking at real world projects
245+
such as <a href="https://github.com/informalsystems/hermes-sdk/">Hermes SDK</a>.</p>
246+
<p>Also check out the <a href="/resources">Resources</a> page to find out more resources
247+
for learning CGP.</p>
248+
<h1 id="contribution">Contribution</h1>
249+
<p>We are looking for any contributor who can help promote CGP to the wider
250+
Rust ecosystem. The core concepts and paradigms are stable enough for
251+
use in production, but we need contribution on improving documentation
252+
and tooling.</p>
253+
<p>You can also help promote CGP by writing tutorials, give feedback,
254+
ask questions, and share about CGP on social media.</p>
255+
<h1 id="acknowledgement">Acknowledgement</h1>
256+
<p>CGP is invented by <a href="https://maybevoid.com/">Soares Chen</a>, with learnings and
257+
inspirations taken from many related programming languages and paradigms,
258+
particularly Haskell.</p>
259+
<p>The development of CGP would not have been possible without strong support
260+
from my employer, <a href="https://informal.systems/">Informal Systems</a>. In particular,
261+
CGP was first introduced and evolved from the
262+
<a href="https://github.com/informalsystems/hermes-sdk/">Hermes SDK</a> project,
263+
which uses CGP to build a highly modular relayer for inter-blockchain communication.
264+
(p.s. we are also hiring <a href="https://informalsystems.bamboohr.com/careers/57">Rust engineers</a>
265+
to work on Hermes SDK and CGP!)</p>
266+
267+
268+
</div>
269+
270+
271+
272+
</main>
273+
274+
275+
<footer>
276+
<small class="subtext">
277+
<a href="https://maybevoid.com">Soares Chen</a> © 2024
278+
</small>
279+
</footer>
280+
281+
</body>
282+
<script>
283+
const scrollHandler = entries => {
284+
// Find the first entry which intersecting and ratio > 0.9 to highlight.
285+
let entry = entries.find(entry => {
286+
return entry.isIntersecting && entry.intersectionRatio > 0.9;
287+
});
288+
if (!entry) return;
289+
290+
document.querySelectorAll(".toc a").forEach((item) => {
291+
item.classList.remove("active");
292+
});
293+
294+
// let url = new URL(`#${entry.target.id}`);
295+
let link = document.querySelector(`.toc a[href$="${decodeURIComponent(`#${entry.target.id}`)}"]`)
296+
if (link) {
297+
link.classList.add("active");
298+
link.scrollIntoView({ behavior: "auto", block: "nearest" });
299+
}
300+
};
301+
// Set -100px root margin to improve highlight experience.
302+
const observer = new IntersectionObserver(scrollHandler, { threshold: 1 });
303+
let items = document.querySelectorAll('h1,h2,h3,h4,h5,h6');
304+
items.forEach(item => observer.observe(item));
305+
</script>
306+
307+
</html>

juice.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)