# EX Script — Comparison with Other Languages

## vs TypeScript

| Aspect | TypeScript | EX Script |
|---|---|---|
| Null handling | `null` + `undefined` everywhere | absent; `T?` only |
| Errors | `throw`/`try/catch` | `Result` values with `!`/`?`/`raise` |
| Config | tsconfig + bundler + linter + formatter + test runner | zero-config `ex` |
| Runtime validation | none (zod et al., separate) | `schema` = type + validator |
| Type declarations | hand-written `.d.ts` | generated type tables |
| Error messages | cryptic type names | what/why/fix with code frames |
| Mutable by default? | yes (`let`/`var`/`const` mix) | no — immutable by default |
| Pattern matching | no | exhaustive `match` built-in |
| Type assertions | `as` (unchecked, hides bugs) | `.require`/`schema` (checked) |
| Async errors | exceptions escape | typed `T!` + `?` propagation |
| Interop | `any` lies | `Any` boundary + validation required |

EX Script is deliberately a *different* language that compiles to JS — it does
not inherit JavaScript's worst footguns.

## vs JavaScript

EX Script is a strict superset of nothing: it compiles to JS but has its own
semantics (no `null`, no `this` confusion in functions, no `==` coercion, no
`var` hoisting). For the 95% of JS that is plain data + functions, translation
is mechanical (see Migration). The JS ecosystem is usable through `js:` imports.

## vs Rust

| Aspect | Rust | EX Script |
|---|---|---|
| Ownership/borrowing | enforced (powerful, steep) | GC (JS runtime) — no borrowing |
| Error handling | `Result<T, E>` with `?` | same idea, lighter syntax `T!`/`?` |
| Enums/ADTs | `enum` with payloads | `type X = A \| B` variants |
| Pattern matching | exhaustive | exhaustive, same spirit |
| Immutability | `let` immutable by default | same |
| Learning curve | weeks | hours (JS familiarity) |
| Compile time | long | < 1 s typical |

EX Script borrows Rust's *safety ideas* (immutability by default, exhaustive
matching, Result errors) but not its syntax or its ownership model. Safety
comes from the type system + runtime checks, not from a borrow checker.

## vs Go

| Aspect | Go | EX Script |
|---|---|---|
| Errors | `if err != nil` everywhere | `?` propagation, one token |
| Generics | verbose, recent | inferred, minimal syntax |
| ADTs/pattern matching | no | yes, exhaustive |
| Async/concurrency | goroutines + channels | async/await + `all`/`race` |
| Ecosystem | standard, small | JavaScript's entire ecosystem |
| Verbosity | high | low |

Go's simplicity is admirable; EX Script targets the same simplicity with more
expressive data modeling.

## vs Kotlin

| Aspect | Kotlin | EX Script |
|---|---|---|
| Null safety | `?`/`!!`/`?:` | `T?`/`.require`/`or` |
| ADTs | `sealed class` + `when` | `type` + `match` |
| Classes | default | available, discouraged |
| Data classes | `data class` | `struct` (built-in) |
| Compiles to | JVM/JS/native | JS |
| Tooling | Gradle (complex) | one `ex` binary |

Kotlin validated the "safe defaults + expressive types" direction; EX Script
removes the JVM ceremony.

## vs modern alternatives (2026 landscape)

- **Zig**: systems-level, manual memory; EX Script is application-level, GC.
  No overlap in audience.
- **Bun/Deno runtimes**: not languages — EX Script runs on them all.
- **tsx/esbuild/swc**: transpilers with TS's semantics; EX Script changes
  semantics (no null, Result errors).
- **Val/Arc**: research languages with ownership; EX Script prioritizes
  approachability over compile-time memory safety.
- **TypeScript 6+/proposals**: still inherit `null`+`throw`; EX Script is the
  only JS-targeted language that removes both at the language level.

## Summary

EX Script occupies the space TypeScript vacated by choice: JavaScript's
ecosystem and reach, with a type system and error model designed for how
applications are actually written in 2026 — HTTP, JSON, async, validation,
CLI tools, small monorepos — rather than the accumulated legacy of the
TypeScript 2.x era.