3 ms·
Funny, I have the reverse feeling, where Typescript is (mostly) intuitive; whereas I admire Clojure and want to love it, but it keeps bouncing off my C-infused
by lukifer 6y ago
Funny, I have the reverse feeling, where Typescript is (mostly) intuitive; whereas I admire Clojure and want to love it, but it keeps bouncing off my C-infused brain.
I have definitely seen type definitions tortured within an inch of their life, especially in third-party libraries, with multiple layers of generics and utility types and unions until it does take a 9000 IQ to parse them (or worse, figure out why a given data structure is throwing a type error).
While I've come to enjoy the "safety net" and autocompletion of strong types, I've discovered what I really want is meta-programming guard-rails. For instance, while I can define `type Foo = 1 | 2 | 3`, I'd like to be able to do something like `type Foo: number = x => x > 0 && x < 4`, with arbitrary meta-logic that be checked at build time, no differently than preventing coercing a string to a number. The full scope of what I want is probably NP-hard (`1 | 2 | 3` does not actually prevent `foo += 3`!), in addition to the constraints of the JS compile target, but I can dream. :)
- amackera 6y agoI totally understand the fascination with type systems. It's just that in my experience, the people are have the most success with intricate type systems are much smarter than I am ¯\_(ツ)_/¯