Comment

Comment by aethros

> why tricks like this aren't used more

Some languages don't support this.

The languages that do would require extensive systems to implement this feature. It may simply not be a priority over other requirements like thread safety, atomicity, etc.

> similar tricks for shell execution

Shell only supports strings, integers and lists. The type system is too limited for this level of type-checking.

This works in typescript due to the advanced type operations built into the language.

parent aethros 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton