News for hackers. Stuff that matters.
Re:Go channels are bad by api on Wednesday March 02, 2016 @11:33AM (#11210978)
I thought Go had gc. Why would you ever need reference counts?
Re:Go channels are bad by voidlogic on Wednesday March 02, 2016 @11:37AM (#11211015)
Non-memory resources that exist within your application.

Example: Perhaps once no instances of an object are in use, you want to remove that object from persistent storage such as a DB.

Re:Go channels are bad by api on Wednesday March 02, 2016 @11:50AM (#11211115)
Does Go not have finalizers? These are mostly solved problems since the Smalltalk era. Haven't learned Go yet and from what I read I'd be better off with Rust or something that would stretch my brain more like Haskell. When I read about it I get the sense that we are reinventing stuff from the 90s. But hey, it's hip.
Re:Go channels are bad by pcwalton on Wednesday March 02, 2016 @12:19PM (#11211331)
Go does have runtime.SetFinalizer: https://golang.org/pkg/runtime/#SetFinalizer

But beware of finalizer ordering issues.

Re:Go channels are bad by catnaroek on Wednesday March 02, 2016 @11:54AM (#11211141)
Sometimes you need to guarantee that resources are cleaned up in a timely fashion. Finalizers don't help here.
Re:Go channels are bad by hacknat on Wednesday March 02, 2016 @11:56AM (#11211151)
Piggy backing off @catnaroek, go does have finalizers too though.
Re:Go channels are bad by chrsm on Wednesday March 02, 2016 @12:14PM (#11211294)
Example: Recently built a small service that responds to requests and walks various files looking for data.

The service can be asked to unload (close) the file, but it's hard to say whether it's in-use at the time without some kind of reference count to current requests using the file.

Re:Go channels are bad by nly on Wednesday March 02, 2016 @12:20PM (#11211343)
That's kinda what dup() is for. Reference counting happens in the kernel.