Ask HN: Do types make a language more expressive, or less? In say, JS vs TS, have I made the language more expressive by adding a type system, or less? |
Ask HN: Do types make a language more expressive, or less? In say, JS vs TS, have I made the language more expressive by adding a type system, or less? |
What types do is make language more precise and deterministic.
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.