A general-purpose, statically typed language with its own runtime: a bytecode VM, garbage collection and lightweight tasks built in.
🚧 Very early work in progress · latest: v0.16 ShigeoA taste
import "std/http"
import "std/io"
func main() -> !void
let server = try http::listen("0.0.0.0", 8080)
io::println("listening on ${server.port()}")
# every connection runs in its own lightweight task
server.serve(func(req: http::Request) -> !http::Response
when req.path
"/" then return http::text("hello ${req.query_param("name") orelse "world"}") end
else then return http::status(404) end
end
end)
end
What's inside
- Static types, light syntaxType inference, immutable by default, string interpolation, errors as values with
try. - Own runtimeCompiles to bytecode for its own VM with a garbage collector. Written in Zig.
- Lightweight tasksConcurrency built in: I/O only makes the calling task wait, never the whole program.
- Batteries includedHTTP client, TCP/TLS, URLs, files, buffers, compression and time in the standard library.
- HTTP servers built inOne task per connection, with gzip compression, timeouts and connection limits out of the box.
- Resources cleaned upThe garbage collector closes files, connections and streams you drop, and
deferhandles the rest.
Install
Dusky is built from source. You need Zig 0.16.0.
git clone -b release https://github.com/duskylang/dusky.git
cd dusky
zig build -Doptimize=ReleaseFast
./zig-out/bin/dusk hello.dsk
This builds the latest release. See the build guide for details.