Hacker News new | past | comments | ask | show | jobs | submit login

Just out of curiosity, what is your go-to language?

C# is probably my favorite general purpose language so far, although I really prefer Golang's goroutines/channels over C#'s async model. Curious to hear other perspectives!




Python for smaller self-contained projects and scripting.

Erlang/Elixir for larger projects where fault tolerance or concurrency is needed.

C/C++ where GC is a no-go (games, low latency, time critical data processing).

Next up in the pipeline to learn and use: Rust


> games

Ever played something like e.g. Bastion?

http://en.wikipedia.org/wiki/Bastion_%28video_game%29

I mean if you are developing the new Unreal Engine - sure. But otherwise gaming industry would benefit from more of maintainable code.


For context, Bastion was written in C#.

Here's what the lead developer said on the topic of GC:

http://www.reddit.com/r/IAmA/comments/lwljh/iama_dev_team_of...



It's simple: when looping either make stuff quick to collect or make it never collect.


I'd love to see a comparison of Golang's goroutines/channels vs async. If you know of one or could write one here, that would be appreciated! :-)


Task<T>/async is a slightly different beast, effectively its a goroutine+channel which can only return 1 value or throw an exception.

A better alternative to channels is Rx (Reactive Extensions) which gives you IObservable<T>. It's very simple and powerful. Observables can be composed using Linq, and they're monadic (if that matters). I like the first class notion that something can fail or be completed (go has close(), which lets you complete a channel, but there is no notion of errors unless you slap a tuple in there).

Rx is available on many platforms (incl JVM, JS).

Rx.NET does not yet support back pressure (Rx 3.0 will, whenever Microsoft release that, maybe at //build). There's an alternative library from Microsoft called Dataflow, though, and Dataflow does support backpressure as well as a lot of other great features. Dataflow is underused, but its great. Rx & dataflow interoperate very easily (.ToObservable() etc)

There are a bunch of videos from Netflix on their use of Rx, which are a good watch if you're interested.

Edit: Channels in Go don't compose: I can't easily take one channel, mutate the values as they arrive, and create another channel from the mutated values. With Rx, that's just `var uppers = keyPresses.Select(key => key.ToUpper())` and now I've got a new stream of data. If keyPresses completes, so does uppers. If it fails, that failure is propagated through uppers. This isn't easy in Go.

goroutines don't have any reasonable kind of monitoring. I can't say "this routine has completed/failed", I have to implement that notion every single time using a WaitGroup or something, and that only handles completion, not failure.

I'm not saying C# is perfect and that go's channels/goroutines don't have any merit, just that there are some things I wish I could do more easily using them.


What is the bind semantic in rx?


For a FRP RX user interface example check out the front page of http://www.reactiveui.net/ (or scroll up a bit where I posted the viewmodel code).

For example of a RX backend API check out https://github.com/AdaptiveConsulting/ReactiveTrader




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: