What's Different From Traditional Programming
For programmers coming from C, Python, and everything else.
If you've written code in C, Python, or most anything else, Sanguis works differently. Here is the honest comparison.
What changes coming from C or Python
Control flow
Sanguis has the control flow you know: if/else, while, and cells are functions. Loops are written with while: the front end knows the word for, but the compiler does not lower it yet, so it is not documented here as a working form. No switch (chain if/else), no goto (a jump is a conditional in disguise).
Data types
| Traditional | Sanguis |
|---|---|
| int, float, double | float (floating-point numbers) |
| string | string |
| bool | true and false, and 0.0 and 1.0 read the same way |
| struct with methods | organ with fields and cells |
| int[], arrays | list, written [1.0, 2.0, 3.0] |
Organs are the struct equivalent: declared fields, methods, and a manifest that travels with the compiled artifact.
Assignment
Inside cells, you assign directly: let x = 5; and x = x + 1;. On the GPU, an organ's field is a wire: writing it drives the wire, reading it senses the wire.
Parallel by default
In traditional languages, code runs sequentially. In Sanguis, the whole grid evaluates simultaneously: every switch, every wire, every pass.
| Traditional | Sanguis |
|---|---|
| Sequential execution | Parallel grid evaluation every sweep |
| Shared mutable state + locks | Snapshot semantics, no races |
| Threads, async, goroutines | Not needed: parallelism is the default |
| Manual synchronization | The engine handles it via sweep snapshots |
All switches see the same snapshot at the start of a sweep. One switch's change is not visible to another switch until the next sweep. Data races are eliminated by design.
One kernel, programs as data
A compiled program is data, not code. The GPU kernel that evaluates it is the same kernel for every program, so there is nothing to ship alongside your program except the kernel. The same artifact runs three ways, the interpreter, the just-in-time engine, and the card path, and all three agree byte for byte.