4 ms·
I was a heavy Typescript user and a big fan. I personally found Go's type system and overall ecosystem to be much easier to grok, especially when it came to int
by matthewmueller 9y ago
I was a heavy Typescript user and a big fan. I personally found Go's type system and overall ecosystem to be much easier to grok, especially when it came to interacting with 3rd party packages. If you read through https://mat.tm/joy/#why https://mat.tm/joy/#why you'll read more about my perspective there.
Actually to my surprise, goroutines and channels can be modeled quite well in Javascript! Right now the compiler uses async/await but for 1.0, I think it's possible to compile it down to ES3.
- sAbakumoff 9y agoDid you try Angular 4 + TypeScript? I recently switched to it after years in React and that's amazing, google really did it right this time. After using it for a while I don't feel any need in any additional tools.
- sAbakumoff 9y agoWait, async/await and co-rotines are completely different concepts, aren't they? the former just separate the moment of execution from the moment of receiving the result, the latter allow to execute the code in parallel. In browser the parallelism is only possible with web-worker.
- MatthewPhillips 9y agoHi Matt! First congratulations. This is a very interesting project, one that I look forward to trying out. I'm wondering if Promises are the right way to compile goroutines though. Promises don't run in parallel, and they actually do block; they don't defer to the event loop. I wonder if compiling to web workers would be possible though...
- matthewmueller 9y agoLet me attempt to clarify a few things with fresh eyes: Javascript doesn't have threads, so true coroutines not really possible (w/o webworkers). If you lock up the event loop in one of Joy's goroutines, the other's won't proceed. This limitation doesn't mean that we can't use the CSP concurrency model in an awesome way in Javascript. If you search NPM for csp or channel, you'll find some good examples. For the Go programs I've come across using goroutines, calling an async function like this (async () => {})() is a good enough approximation for frontend development. You may lose out on true parallelism and better error handling, but that's the JS environment we're targeting.
- sAbakumoff 9y agoThe only problem is co-rotines are not really useful in the fat client SPA's. They are all about data flow and event handling.
- boomlinde 9y ago> Javascript doesn't have threads, so true coroutines not really possible (w/o webworkers). A coroutine is not a thread and an implementation of coroutines does not (necessarily) depend on threads. Goroutines can also run on a single thread.