I was initially tempted to implement lots of little things, such as
promises/futures, in Go - but I am quickly learning to change my opinion...
the truth of the matter is that futures is just a pattern - and in Go it is
actually a very easy and simple pattern to implement without any framework
or helper functions:


I find that a lot of things for which I would write (or find) "frameworks"
in other languages are simple and natural in Go, and frameworks for things
that are already simple in Go don't tend to add anything - in many cases,
they actually take something away.

Just my $.02 :-)

On Wednesday, October 2, 2013 3:29:46 AM UTC-4, Thomas Bruyelle wrote:

Thanks Steven your solution solves a sync issue and is very elegant !
You are right, the main issue is the need of rewrite the type, and afaik
there is no generics in go.

I coded a kind of constructor for Future so the user doesn't have to
create the channel. Also I tried to implement error handling, but don't
know if it's good to use the same interface{} value to store the result or
the error. Maybe I should use multiple return values.


You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 15 of 16 | next ›
Discussion Overview
groupgolang-nuts @
postedOct 3, '12 at 4:29p
activeJan 12, '14 at 7:31p



site design / logo © 2022 Grokbase