top | item 39808836

(no title)

aethros | 1 year ago

> 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.

discuss

order

taeric|1 year ago

Apologies, I meant the equivalent of `os.popen` in python. You'd almost certainly only support a subset of what a shell actually supports, but that would almost certainly be for the best.

Basic point being that the equivalent of named/delimited parameters with pretty much forced support for escaping such that you have to go out of your way to send raw strings.

I think, bottom line, it bemuses me that the default "convenience" methods are almost always "send this string over to another process to evaluate it" instead of any processing locally on it. That feels it would be far better as the power "escape hatch" instead of the "convenience method" that it is often pitched as.