TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Go channels, goroutines and GC available in Nim

147 pointsby pwernersbachalmost 10 years ago

5 comments

stcredzeroalmost 10 years ago
<i>This document describes how the GC works and how to tune it for (soft) realtime systems.</i><p><i>The basic algorithm is Deferred Reference Counting with cycle detection.</i><p>I&#x27;m sitting here feeling very impressed. Deferred reference counting has very good semantics for games. Even better, you can control the cycle detection part separately and run that part at an advantageous time. (Though it&#x27;s probably better to just let GC do its thing, unless you really know what you&#x27;re doing.)<p>I am currently writing a multiplayer game server in golang, by making sure almost everything is allocated on the stack, and heap sizes are small. This gives me an efficient, nearly pauseless server. However, something like Nim could give me even more flexibility.
评论 #9641490 未加载
kodablahalmost 10 years ago
I always wanted to see a Go&#x2F;Nim interop project in a little different vein. Since Nim is a superset of Go (and Go is fairly simple), why not a Go implementation in Nim via cross-compilation? Then you can even build a Nim macro that does a &quot;Go get&quot; and Nim developers can use Golang libraries right in their code as imports. Not to mention we get a full, alternative Go impl.<p>It should be easy to bootstrap by first using Go&#x27;s parser to dump some AST that Nim code can then translate, and then once that version is done, just reference the Go parser using this new impl. The only real struggle with the project from what I can see is deciding which standard library items to use the Go transpiled implementation (probably most of them) vs which need to have Nim backends (e.g. runtime package). Meh, just rambling thoughts in my head I was considering playing with given the time...
评论 #9641758 未加载
评论 #9641525 未加载
评论 #9641238 未加载
Manishearthalmost 10 years ago
This is awesome! Go&#x27;s channels and green threads were one of the features I really liked about Go. One more reason for me to go past basic prime number programs in Nim :)<p>I&#x27;m hoping to see Rust get green threads&#x2F;tasks&#x2F;goroutines too. I&#x27;m working on a GC myself, and hopefully someone is trying out a green thread scheduler.
bmurphy1976almost 10 years ago
I&#x27;m very curious to hear the pros and cons of this from somebody who has intimate knowledge of Nim internals. I really really like Go&#x27;s CSP model and would love to see it properly supported in another lightweight non-jvm language (yes I know about Erlang, it doesn&#x27;t fit the bill for me).
评论 #9641094 未加载
评论 #9643299 未加载
jeremyjhalmost 10 years ago
I thought the Go runtime runs foreign code on M:M threads; e.g. when Go time calls foreign code, it dedicates a thread to it. This is so foreign libraries (which are unaware of yielding to the Go scheduler when they do I&#x2F;O) don&#x27;t block a thread with multiple goroutines scheduled on it. I do not think Nim code can run &quot;in a goroutine&quot;.
评论 #9643228 未加载