Re:TC39 Pipeline Operator – Hack vs. F#
by eyelidlessness on Wednesday September 15, 2021 @11:40AM
(#28540502)
> Because the language doesn't map cleanly into formal types doesn't mean it's poorly designed.
Oh, I wasn’t saying the language is poorly designed. I was saying the particular JavaScript code where people complain about the TypeScript types is usually poorly designed. It’s not the types’ fault the interface is so convoluted the types describing it are also convoluted.
Like people write variadic functions that take arguments, or an options map, or a boolean, or a magic string or enum… and then say “there’s 100 lines of types describing this functiona! That’s such a pain!” And like, yeah, it is a pain understanding what your function does.
> Look at shell scripting. Imagine trying to apply a type system to shell scripts. It wouldn't map cleanly at all because (almost) everything is a string, and the operations define how those strings are interpreted - not the data itself.
Amusingly, you’d end up with a type system a lot like TS. Particularly template literal and mapped types.
> However for what it is, shell scripting is quite useful. Most would argue it has a simple interface, simple syntax, simple concepts.
I think this is the only point of disagreement for me here. I find shell scripting absolutely painful, and try to do as little of it as possible.
Oh, I wasn’t saying the language is poorly designed. I was saying the particular JavaScript code where people complain about the TypeScript types is usually poorly designed. It’s not the types’ fault the interface is so convoluted the types describing it are also convoluted.
Like people write variadic functions that take arguments, or an options map, or a boolean, or a magic string or enum… and then say “there’s 100 lines of types describing this functiona! That’s such a pain!” And like, yeah, it is a pain understanding what your function does.
> Look at shell scripting. Imagine trying to apply a type system to shell scripts. It wouldn't map cleanly at all because (almost) everything is a string, and the operations define how those strings are interpreted - not the data itself.
Amusingly, you’d end up with a type system a lot like TS. Particularly template literal and mapped types.
> However for what it is, shell scripting is quite useful. Most would argue it has a simple interface, simple syntax, simple concepts.
I think this is the only point of disagreement for me here. I find shell scripting absolutely painful, and try to do as little of it as possible.