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: README.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,6 +62,8 @@ KernelScript addresses these problems through revolutionary language features:
62
62
63
63
✅ **Zero-boilerplate shared state** - Maps are automatically accessible across all programs as regular global variables in a programming language
64
64
65
+
✅ **Ergonomic map idioms** - Declaration-as-condition (`if (var s = m[k]) { s.field = ... }`) and compound assignment on map indices (`m[k].count += 1`) compile down to a single presence-checked lookup with in-place mutation, no manual write-back
66
+
65
67
✅ **Builtin kfunc support** - Define full-privilege kernel functions that eBPF programs can call directly, automatically generating kernel modules and BTF registrations
66
68
67
69
✅ **Unified error handling** - C-style integer throw/catch works seamlessly in both eBPF and userspace contexts, unlike complex Result types
-**Pointer-returning expression**: present iff non-null. Useful with
3331
+
helpers and kfuncs that may return `null`.
3332
+
3333
+
Semantics:
3334
+
3335
+
-**Single evaluation.**`expr` is evaluated exactly once; its presence
3336
+
test guards both branches.
3337
+
-**Scoping.**`name` is in scope only inside the then-branch. Referencing
3338
+
it from the else-branch (or after the `if`) is a compile-time error.
3339
+
-**No reassignment.**`name` shadows nothing visible to the else-branch
3340
+
and may shadow an outer binding only inside the then-branch.
3341
+
-**Else is optional.** As with the expression-condition form, the
3342
+
`else` branch may be omitted.
3343
+
-**Lowering.** The form lowers to a single `bpf_map_lookup_elem` (or the
3344
+
underlying pointer-returning call), a null check, and the chosen
3345
+
branch — there is no second lookup.
3346
+
3234
3347
#### 7.5.2 Match Expressions
3235
3348
3236
3349
KernelScript provides `match` expressions for efficient multi-way branching. Match is an expression that returns a value and can be used anywhere an expression is expected.
0 commit comments