6 ms·
Anybody knows the status of light-weight threads, channels and automatic multiplexing ("mapping") of light-weight threads on operating system threads in Crystal
by samuell 6y ago
Anybody knows the status of light-weight threads, channels and automatic multiplexing ("mapping") of light-weight threads on operating system threads in Crystal?
(This has been promised to come in Crystal (as opposed to pretty much any other language than Go), but has always seemed to be "yet to come").
- mauricio 6y agoIt's available https://crystal-lang.org/reference/guides/concurrency.html https://crystal-lang.org/reference/guides/concurrency.html. Fibers (like goroutines) are scheduled by Crystal and map to system threads. The work on parallelism is available as a compile-time flag, but not yet GA: https://crystal-lang.org/2019/09/06/parallelism-in-crystal.html https://crystal-lang.org/2019/09/06/parallelism-in-crystal.h...
- kodablah 6y agoOne wonders, once it is GA, if there is value in a Go transpiler. There is a lot of useful software in Go land that would be immediately useful for Crystal devs, and Go itself is not too complicated to map to another language with the same features (a few of the runtime features will have to be emulated).
- unixhero 6y agoHow would this be achieved? Could you expand a little on this idea?
- hootbootscoot 6y agoan IR interface, lol
- kodablah 6y agoLiterally convert Go code to Crystal code. I have not looked into Crystal enough to confirm it's features are a superset of Go's. For example, I saw that Kotlin w/ the advent of their coroutines, had most of Go's features so I wrote a transpiler[0] that got pretty far (can run all of this [0]). I abandoned the project because I have abandoned the JVM. 0 - https://github.com/cretz/go2k https://github.com/cretz/go2k 1 - https://github.com/cretz/go2k/tree/master/compiler/src/test/go https://github.com/cretz/go2k/tree/master/compiler/src/test/...
- samuell 6y agoThanks!