3 ms·
No favorite but here’s some things I like about a few: - TypeScript: the type system is incredibly powerful and expressive. You can guarantee wild things at co
by eyelidlessness 5y ago
No favorite but here’s some things I like about a few:
- TypeScript: the type system is incredibly powerful and expressive. You can guarantee wild things at compile time without a single runtime test.
- Clojure: very simple and elegant way to learn/introduce FP.
- Rust: I’m learning it now, and while I definitely understand why it’s considered difficult to learn… it’s certainly much less intimidating (in my experience) than other systems programming languages, in particular because of the borrow checker.
- LEDThereBeLight 5y agoI'm surprised to see Typescript as a favorite language. I use it every day, and I kind of see it as a necessary evil, but not something I particularly enjoy. I guess I'm saying this to ask, am I doing something wrong? I feel like there's essentially no useful type inference, writing custom types is a nightmare because everything has its own special keyword rather than a simple core set of composable types, error messages feel intentionally vague, and having to write constructors and custom "isType" checks for every type you define is a massive chore. In Haskell I could write: data Tree a = Leaf | Branch (Tree a) a (Tree a) tree = Branch (Branch Leaf 1 Leaf) 3 (Branch Leaf 2 Leaf) whereas in typescript it would be something like: type Leaf = { type: 'leaf' } type Branch<a> = { type: 'branch' v: a l: Tree<a> r: Tree<a> } type Tree<a> = Leaf | Branch<a> const isLeaf = (l: any): l is Leaf => l?.type === 'leaf' const isBranch = <a,>(b: any): b is Branch<a> => b?.type === 'branch' const isTree = <a,>(t: any): t is Tree<a> => isLeaf(t) || isBranch<a>(t) const Leaf = (): Leaf => ({ type: 'leaf' }) const Branch = <a,>(v: a, l: Tree<a> = Leaf(), r: Tree<a> = Leaf()): Branch<a> => ({ type: 'branch', v, l, r }) const tree = Branch(2, Branch(1), Branch(3)) How does this not feel like a major pain in the ass? Is there a simpler way to get typescript to do all the boilerplate for you?
- idontwantthis 5y agoDon’t focus so hard on guaranteed type safety, and write more code. For real engineering I think it’s a wonderful compromise between formality and practicality.