The Wuffs project is both a programming language and a standard library written in that programming language (and then e.g. transpiled to C). For more

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2024-10-10 12:00:02

The Wuffs project is both a programming language and a standard library written in that programming language (and then e.g. transpiled to C). For more details on the latter, see the Wuffs the Library document. As for Wuffs the Language, it is an imperative C-like memory-safe language that should look roughly familiar to somebody versed in one of C, C++, Go, Java, JavaScript, Rust, etc. The major differentiating features are:

Types read from left to right: ptr array[100] base.u32 is a non-null pointer to a 100-element array of unsigned 32-bit integers. Types can also be refined.

Structs are a list of fields, enclosed in parentheses: struct foo(x: base.u32, y: base.u32), possibly extended (by a +) with a second list of optionally initialized fields. The struct name, foo, may be followed by a question mark ?, which means that its methods may be coroutines.

Function definitions read from left to right. func foo.bar(x: base.u32, y: base.u32) base.u32 is a function (a method on the foo struct type) that takes two base.u32s and returns a base.u32. Each argument must be named at the call site. It is m = f.bar(x: 10, y: 20), not m = f.bar(10, 20).

Leave a Comment