Design philosophy#
Meta: the "why is it like this" page, in one arc: principles → what they rule out → what they produce. Keep it opinionated and short. The applied list is mental-model seeds — one bullet per "thing you won't have seen elsewhere," each linking to the chapter that owns it; don't repeat topic-page material here.
- familiarity over theory
- ergonomics over syntactic purity
- expressiveness over performance
- safety over surprises
- "a leaf in the wind" — low cognitive overhead so brainpower stays on the glued-together product
Deliberately missing#
- no inheritance (only
implementsfor interfaces — see Interfaces and unions) - no metaprogramming / macros
The philosophy, applied#
These principles are why Dang reads the way it does — the things you'll notice are different, each owned by its own chapter:
- types and root functions come from a GraphQL schema, not handwritten declarations (GraphQL interop)
- prototype-based objects (
type Foodeclares both a type and its constructor) (Objects (type)) - multi-field selection:
user.{{name, posts.{{title}}}}becomes one query (Objects (type)) - null tracking in the type system (
String≠String!) (Types and nullability, Flow-sensitive narrowing) - optional parens for zero-arg calls — fields and methods feel the same (Fields)
- directives instead of comment pragmas (Directives)
- directory-level modules — split files however (Modules and imports)
assert { ... }built in — high-level testing without a framework (Standard library reference, Errors:try,catch,raise)
Meta: runtime model in one paragraph, still to write — pitch it as "values are immutable; methods on types look mutating but return a forked copy." That single line saves a lot of confusion later in Mutation and copy-on-write.