Sample Echo programs that exercise the language surface and a small HTTP app.
| File | Role |
|---|---|
surface.echo |
Kitchen sink — full surface + user / user_extra |
main.echo |
Finite HTTP demo: in-process dispatch + live TCP smoke |
server.echo |
Long-running HTTP server (http.serve) |
config.echo |
# constants + export |
user.echo |
% user shape + methods |
user_extra.echo |
@ user extra members |
users.echo |
free helpers + user.user { … } lits |
routes.echo |
handlers as function values |
cargo build -p xo
./target/debug/xo run --no-cache examples/app/surface.echo
./target/debug/xo run --no-cache examples/app/main.echo
./target/debug/xo run --no-cache examples/app/server.echo # blocks; curl /health
./target/debug/xo check examples/app/main.echoImports are module-scoped: / std/io → io.log, not bare log.
See docs/modules.md.
- Builds routes and dispatches sample GETs in-process (no sockets).
- Listens on
127.0.0.1:18080, serves one real connection viahttp.handle_connectionin a task (+ () [lis, table] { … }), clientGET /health, then joins and exits (finite; e26/CI friendly).
Calls http.serve("0.0.0.0:8080", routes) — nonblocking accept loop, one
task per connection (+ handle_connection(conn, routes)).
# terminal 1
./target/debug/xo run --no-cache examples/app/server.echo
# terminal 2
curl -s http://127.0.0.1:8080/
curl -s http://127.0.0.1:8080/health
curl -s http://127.0.0.1:8080/users| Area | Exercised |
|---|---|
Leaders ~ $ # % @ |
binds, shape, @ extra members |
Leaders ? : |
if / else-if / else |
Leaders * < > |
loops |
Leaders | |
match |
Leaders ! ^ |
result / return |
Leaders / \ |
import / export |
Leaders + - |
tasks (also in main.echo live smoke) |
| Free fns / methods | counters, user |
| Lits / collections / ops | kitchen sink |
When you lock a new language feature, extend surface.echo (or a sibling)
and keep xo run green for surface.echo and main.echo.