6 ms·
> I'd be just as fund of another language that would be functional, immutable, interactive and with smart abstractions. You get all of the above with TypeScrip
by SomeCallMeTim 9y ago
> I'd be just as fund of another language that would be functional, immutable, interactive and with smart abstractions.
You get all of the above with TypeScript except immutability. Pull in Lodash for extra functional sauce, or the functional variant of Lodash for increased composability. And the serialization format is the industry standard JSON.
Events are really a necessary tool. You're the first person I know of to complain of "event hell;" event-based programming is a key feature of modern operating systems and browsers and applications. I haven't used a CSP (it looks like a Lisp thing?), but it doesn't look like a full replacement for events, but rather streams? And there are functional stream libraries in JavaScript/TypeScript. [0]
I don't deny that having macros as a "sometimes feature" would be a good thing. I just can't stand the Lisp zillions of nested parenthesis. (Thankfully JavaScript callback-hell is also a thing of the past with async/await and Promises...I don't like zillions of levels of callbacks either).
I think once you have static types, immutability isn't as critical, but if you're set on it, there's always Immutable.js [1]
> On static vs dynamic type systems, I still don't know. I like types, they feel good to have, but I just don't feel they really help, I think they're a false sense of safety, and they just slow you down. That said, maybe they pay back in the long term maintainance, I'm still unsure though.
Technical debt earns compound interest over time. Static type systems let you zero out technical debt for almost no effort.
The only "slow you down" I get from TypeScript is defining declarations for libraries that are missing them. That's about 5 minutes to 15 minutes per library. That's an extremely low up front cost to pay, and everything else about TypeScript is faster (auto complete on object members) and better (refactoring is fast and easy enough that it's easy to "just do it" and not put it off until later).
[0] http://reactivex.io/ http://reactivex.io/ or https://github.com/cujojs/most/ https://github.com/cujojs/most/ are good examples.
[1] http://facebook.github.io/immutable-js/ http://facebook.github.io/immutable-js/
- didibus 9y agoYa, I would probably be happy with TypeScript. How's the backend story? Is using it with node easy? Is there an interactive mode, or just quick transpilation?
- SomeCallMeTim 9y agoIt's pretty trivial to use with Node. You just need to have a source folder, set up your tsconfig.json file with your preferred options, and then run: tsc --watch There's also an REPL for Node here: https://www.npmjs.com/package/ts-node I find it a bit tricky to do anything complex in, though. Since TypeScript is mostly ES2015 anyway, when I want interactive anything I usually just use an ES2015 interpreter (like Node itself). The types usually make interactive stuff more challenging.