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.

RxGo: Reactive Extensions for the Go Language

74 pointsby deepanchorover 8 years ago

7 comments

dtechover 8 years ago
I'm a fan of the Rx programming model, but is it really worth it to introduce such a library and model into a language with such an opinionated and built-in model for streaming/pipelining and concurrency?
评论 #13562972 未加载
评论 #13562669 未加载
评论 #13562569 未加载
评论 #13562898 未加载
omginternetsover 8 years ago
On the one hand this seems like a strange decision given that Go purposefully avoids asynchronous code. On the other hand, I think this project is trying to get at something that is (IMHO) a blind-spot for the Go community. Namely: I find it difficult to design abstract data-flow patterns and encapsulate behind a nice API.<p>Go is great for dealing with the nitty-gritty of concurrency, but I find it hard to express a high-level vision of what&#x27;s going on in my app&#x2F;lib. This is why this project <i>almost</i> feels good. There&#x27;s a clear view of what we&#x27;re manipulating and how we&#x27;re positioned relative to the data.<p>Has anybody else struggled with this?<p>The closest thing I&#x27;ve found to a solution has been go-mangos[0], a native go implementation of the scalable protocols. This is extremely useful for designing the data-flow of an application when I&#x27;m shuffling bytes around, but what I find myself wanting is an equivalent system for raw (i.e.: unserialized) Go data-structures.<p>I want to be able to do something like this (assume a hypothetical library to this effect called `portal`):<p><pre><code> p0, _ := portal.NewPortal(iface, portal.REP) &#x2F;&#x2F; iface is a types.Interface p0.Bind(&quot;foo&quot;) p1, _ := portal.NewPortal(iface, portal.REP) p1.Dial(&quot;foo&quot;) go func() { for { i, _ := p0.Recv() &#x2F;&#x2F; `i` guaranteed to satisfy the interface represented by `iface` i.DoSomething() p0.Send(i) } }() p1.Send(iRequest) iResult, _ := p1.Recv() </code></pre> I&#x27;m very curious to get some feedback on this idea. It&#x27;s been gnawing away at my brain for a while now.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;go-mangos&#x2F;mangos" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;go-mangos&#x2F;mangos</a>
chris_7over 8 years ago
Rx not encoding side effects in the type system, as ReactiveSwift does, is very unfortunate.
azinman2over 8 years ago
Isn&#x27;t this what channels are for? Doesn&#x27;t Go have this already built in?
评论 #13566491 未加载
alpbover 8 years ago
FWIW not exactly related, but check out Go-LINQ as well. <a href="https:&#x2F;&#x2F;github.com&#x2F;ahmetalpbalkan&#x2F;go-linq" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ahmetalpbalkan&#x2F;go-linq</a> (disclaimer: my project). I will take a look at combining RxGo and Go-LINQ and probably will write a blog post soon.
xerover 8 years ago
The examples lack the elegance of RxJS. I&#x27;m gonna stick with the Channels for a further while.
omegaworksover 8 years ago
Why is Rx so huge? What does it give you that Promises dont?
评论 #13567222 未加载
评论 #13566439 未加载
评论 #13566610 未加载