News for hackers. Stuff that matters.
Re:More Gotchas of Defer in Go, Part II by mratzloff on Thursday December 21, 2017 @03:46PM (#15982585)
Go has a garbage collector. RAII is only viable in languages where destruction is predictable, like C++ or PHP.
Re:More Gotchas of Defer in Go, Part II by int_19h on Thursday December 21, 2017 @03:56PM (#15982661)
"defer" is effectively used for predictable destruction in Go, and a more automated RAII scheme could be used in its place.

C++/CLI is a language that targets a garbage-collected runtime, yet has full-fledged RAII semantics (they're mapped to CLR Dispose pattern).

Re:More Gotchas of Defer in Go, Part II by mratzloff on Friday December 22, 2017 @02:11AM (#15985772)
Oh, I totally forgot about C++/CLI! You're absolutely right; that's my mistake. I do agree that RAII is preferable.
Re:More Gotchas of Defer in Go, Part II by pjmlp on Friday December 22, 2017 @02:46AM (#15985892)
PHP also has a garbage collector.

Swift and D also have garbage collectors and support RAII.

And since I already see it coming, reference counting is a garbage collection implementation algorithm in computer science literature.

Re:More Gotchas of Defer in Go, Part II by mratzloff on Friday December 22, 2017 @12:36PM (#15989264)
Yep, and I even referred to reference counting earlier in the week as garbage collection, so I'm going to assume I was having memory corruption with my answer. :-)
Re:More Gotchas of Defer in Go, Part II by pjmlp on Friday December 22, 2017 @02:24PM (#15990150)
Hehe :)
Re:More Gotchas of Defer in Go, Part II by pcwalton on Thursday December 21, 2017 @05:08PM (#15983286)
The tracing GC certainly complicates things, but you can make it work with a "scope" keyword like in D.