The tour
Eight short programs, each showing one thing W# does differently.
Every program on these pages is a real file in the compiler’s repository, run by its test suite on every commit, and quoted here in full rather than trimmed. You can follow along:
git clone https://github.com/sinisterMage/WSharp
cd WSharp
wsharp run examples/status.wsThe order matters a little. Dispatch and Inference are the two ideas the rest of the language is arranged around, so read those first. After that the pages are largely independent.
- Multiple dispatch A response renderer written as a set of small overloads rather than a growing switch.
- Type inference Not a single type is written down, and every one of them is still checked.
- Optionals and errors ?T may be absent, !T may have failed, and !T says which failures it means.
- Structs and closures Nominal records, implicit widening to a supertype, and functions as values.
- Arrays and lists A fixed-length array whose count is in its header, and the growable type built on it.
- Generics Explicit type parameters on functions, structs and fn literals, all monomorphised.
- Modules @import binds a module to a name, pub says what another module may see.
- Workers and the broker Threads that own their heaps, talking by typed calls or through a partitioned log.