notes > pl-features-i-like
Programming language features I like
- Lightweight namespaces (
mod
in Rust, module
in OCaml)
- This is one feature I really wish Python had.
- Algebraic data types with pattern matching (Rust, OCaml)
- This is the other feature I really wish Python had.
- Option types instead of implicitly nullable types (
Option
in Rust, option
in OCaml)
- Result types instead of exceptions (
Result
in Rust, Or_error.t
in OCaml)
- Rust's
?
syntactic sugar makes them especially ergonomic.
(T, error)
return types in Go are similar. Some don't like them; I still prefer them to exceptions.
- Lightweight named tuples (
~x, ~y
in [[OCaml]])
- Great for return types of functions that don't warrant a full record type
Table stakes
- First-class syntax for looping over a sequence (e.g.,
for ... in
in Python)
- Some kind of ternary conditional expression (
cond ? x : y
in [[C]], x if cond else y
in Python, etc.)