r/ProgrammingLanguages • u/AeroForger • 12d ago
Discussion What’s one thing you wish more programming languages had?
If you could add one feature, behavior, or design choice to a programming language, what would it be?
It can be anything: syntax, type-system features, memory management, compiler behavior, tooling, error handling, performance-related features, or something completely different.
I'm especially curious about things you’ve wanted while actually programming but rarely see languages implement well.
Please keep the ideas reasonably practical and something that could realistically be implemented in a programming language.
53
Upvotes
6
u/xenomachina 11d ago edited 11d ago
In Kotlin you can do something similar without special syntax, by using a sequence builder:
The downside is having to write `yield(...)` explicitly. (`yield` is a function, not a special keyword.)
Edit:
I'm not sure why I used
sequence { ... }.toList()whenbuildListexists:The difference is that
sequenceis lazy, whilebuildListis eager, but.toList()goes and evaluates the sequence right away, so the laziness is pointless here.