Settings

Theme

Ask HN: Do types make a language more expressive, or less?

4 points by greenlimetea a day ago · 4 comments · 1 min read


In say, JS vs TS, have I made the language more expressive by adding a type system, or less?

prologic 5 hours ago

Yeah no. Types don't make languages "more expressives". That just makes contracts (e.g: API(s) between callees and callers) more contractual and precise.

What does make a language more expressive (which may or may not be a good thing, that's a matter of taste) is powerful primitives that ladder up to more complex patterns and interesting ways to "express" ideas.

For example. One of the most expressive languages (arguably) is Lisp, or Io or other languages that have a property we call Homoiconicity -- meaning that the language's AST can be expressed and modified in the runtime of the language itself.

Macros are another feature that can make languages far more expressives too with similar effects.

Python's dunder methods, e.g: `__add__` are also another expressive feature (or anti-feature depending on how you use/abuase them) of Python.

jqpabc123 a day ago

More expressive --- I don't necessarily think so.

What types do is make language more precise and deterministic.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection