This project uses Moxie — a compiled systems language for domain-isolated programs. Moxie descends from TinyGo but is its own language with .mx source files, moxie.mod modules, and a restricted execution model.
Read [../moxie/REFERENCE.md](../moxie/REFERENCE.md) before writing any code.
These are compile errors. Violating them wastes a build cycle.
string and []byte are the same type. Identical 3-word layout (ptr, len, cap). Mutually assignable. Use string in signatures for readability.int and uint are always 32-bit. len() and cap() return int32.range over text yields bytes, not runes.| Construct | Compile Error | Use Instead |
|---|---|---|
go f() | No goroutines | Channels + select for dispatch, spawn for isolation |
make(T, ...) | Removed | Literal syntax: []T{:n}, chan T{}, map[K]V{} |
new(T) | Removed | &T{} or var x T; p := &x |
"a" + "b" | No + on text | "a" \| "b" (pipe operator) |
fallthrough | Removed | case A, B: comma-separated |
complex64/128 | Removed | Not supported |
uintptr | Removed | Explicit pointers. Allowed with import "unsafe" |
import "strings" | Removed | import "bytes" (they're the same type) |
| Moxie | Description |
|---|---|
[]T{:n} | Slice with length n |
[]T{:n:c} | Slice with length n, capacity c |
chan T{} | Unbuffered channel |
chan T{n} | Buffered channel with capacity n |
map[K]V{} | Empty map |
make() is a compile error in user code. Use literal syntax only.
make build
# or directly:
MOXIEROOT=../moxie ../moxie/moxie build -o gitweb .
gitweb is a single-file Moxie application (main.mx) that serves a git hosting frontend. It implements HTTP handling directly (raw TCP + manual HTTP parsing) because net/http is broken in Moxie's runtime. Deployed via Docker to git.smesh.lol.
Key details:
.mx source fileunsafe and syscall for raw clone/execve (git-http-backend CGI)string=[]byte aliasing means bytes.Buffer.String() returns an alias — copy if reusing the buffernet/http broken — bypass entirely, use raw TCP + manual HTTP parsingSetReadDeadline causes instant timeout — never use net.Conn deadlinesSprintf can corrupt earlier results (string=[]byte means shared backing) — always copyFix upstream in ../moxie first, then rebuild gitweb.
ALLOWED:
FORBIDDEN without approval:
go keyword (it's a compile error)+ for text concatenation (use |)make() (use literal syntax)new(T) (use &T{})