News for hackers. Stuff that matters.
Re:Go 1.10 Beta 1 is released by baby on Friday December 08, 2017 @06:19AM (#15878023)
hell no, if generics get into go I'll have to find another favorite language.
Re:Go 1.10 Beta 1 is released by camus2 on Friday December 08, 2017 @07:34AM (#15878249)
> hell no, if generics get into go I'll have to find another favorite language.

Well, I hope go get generics fast then. Seriously, what is this community that rejects any possible enhancement to a language? Even C gets new features albeit slowly. A language that doesn't evolve is a dead one.

There is nothing complicated with generics, they are just incomplete types, that's all. Generics =/= C++ templates.

Ada has a great implementation of generic programming which forces the developer to complete generic types before using them. In fact Ada got a lot of things that go got wrong despite being way older, especially when it comes to concurrency and types.

Package based generics make them completely compile time and runtime safe, no type erasure. The'd be the equivalent of reflect.MakeFunc or reflect.MakeStruct at compile time, so without any performance penality or ugly reflection, which go has right now.

Re:Go 1.10 Beta 1 is released by geodel on Friday December 08, 2017 @09:47AM (#15878919)
I feel what is with this demand that Go has to have generics when there are some excellent languages with Generics available.
Re:Go 1.10 Beta 1 is released by axaxs on Friday December 08, 2017 @01:21PM (#15880665)
I'm on the fence about generics...but to answer your question generally...it's not all 'enhancements', it's making a language less readable. Sure, I can choose never to use it. But now I have (more) trouble reading others code. Go's strength, to me, is readability.
Re:Go 1.10 Beta 1 is released by nevercomments on Friday December 08, 2017 @01:57PM (#15880959)
People programming in Go today already have workarounds to provide the functionality of generics, but at the cost of type safety and speed.

It is very common (especially in libraries) to pass `interface{}` around and use reflection to do manual type checking and type casting.

With generics the code that uses `interface{}` today would actually be much more readable, because the intention of the author would be clear.

Re:Go 1.10 Beta 1 is released by Zach_the_Lizard on Friday December 08, 2017 @08:01AM (#15878365)
Go has generics, but only for the blessed few built-in functions and types the Go team decided we couldn't live without.

We just want that special casing gone so we could write, say, a generic set that works just as well as map

Re:Go 1.10 Beta 1 is released by a-saleh on Friday December 08, 2017 @07:23AM (#15878230)
Why? Like, I might have weird taste, because I really liked generics and even Java-style checked exceptions :-) And to me, generics always sounded like the most practical way to do safe code-reuse across various types.
Re:Go 1.10 Beta 1 is released by baby on Friday December 08, 2017 @09:44AM (#15878897)
They add complexity which makes understanding and auditing code much harder. Look at OpenSSL and their overuse of macros, or heavily-templated C++ code.
Re:Go 1.10 Beta 1 is released by gopher_protocol on Friday December 08, 2017 @04:43PM (#15882316)
No one is asking for C/C++ style macros, or even C++ templates. Go generics would be closer to Java or C# generics, which increase code clarity, reduce boilerplate and copy/paste code, and communicate intent.
Re:Go 1.10 Beta 1 is released by baby on Sunday December 10, 2017 @12:20PM (#15892343)
I see. If it can be implemented as something that make code easier to read and not worse. Why not. But I’d need to see a clear example of that.
Re:Go 1.10 Beta 1 is released by a-saleh on Friday December 08, 2017 @01:42PM (#15880825)
Fair. In my opinion generics are good alternative to macros or templates, because they are much more constrained.
Re:Go 1.10 Beta 1 is released by ComputerGuru on Friday December 08, 2017 @07:13AM (#15878192)
Yeah, I can see how having features added to your favorite language while remaining fully compatible with the code you write today would warrant such a reaction. I mean, just having them in your language, even if you don’t have to use them is just so horrible.
Re:Go 1.10 Beta 1 is released by Skinney on Friday December 08, 2017 @07:20AM (#15878214)
I think it would be naive to believe that adding generics to Go would have no effect on the stdlib, third party packages, and ultimately how you write Go code.
Re:Go 1.10 Beta 1 is released by JustSomeNobody on Friday December 08, 2017 @09:04AM (#15878653)
I don't have a dog in this hunt, but if a feature is in a language, someone will use it which will mean eventually everyone has to.
Re:Go 1.10 Beta 1 is released by geodel on Friday December 08, 2017 @09:44AM (#15878890)
Well the same is true for multiple languages which will mean not everyone has to use Go. Especially when there are so many interesting languages to choose from.
Re:Go 1.10 Beta 1 is released by baby on Friday December 08, 2017 @09:43AM (#15878887)
What are you saying, you never read other people's code? That's actually my job.
Re:Go 1.10 Beta 1 is released by omginternets on Friday December 08, 2017 @07:22AM (#15878226)
In his defense, just because you don't write generics yourself doesn't mean you don't encounter them.
Re:Go 1.10 Beta 1 is released by pjmlp on Friday December 08, 2017 @07:09AM (#15878176)
Good luck, even C11 has light generics nowadays.
Re:Go 1.10 Beta 1 is released by leshow on Friday December 08, 2017 @09:59AM (#15879025)
light generics? C++ has very powerful generics and has had them for a long time, going under the name 'template metaprogramming'.
Re:Go 1.10 Beta 1 is released by jjnoakes on Friday December 08, 2017 @10:13AM (#15879143)
He said C11, not C++(11).
Re:Go 1.10 Beta 1 is released by pjmlp on Friday December 08, 2017 @01:24PM (#15880700)
I am speaking about C, not C++.
Re:Go 1.10 Beta 1 is released by yen223 on Friday December 08, 2017 @07:57AM (#15878346)
Golang arrays and maps are generic ...
Re:Go 1.10 Beta 1 is released by baby on Friday December 08, 2017 @09:45AM (#15878900)
Yes, but I do not have to read their implementation fortunately, and not so many things in Go use generics if I do want to read their implementation.
Re:Go 1.10 Beta 1 is released by roflcake11 on Friday December 08, 2017 @10:54AM (#15879524)
This post basically proves that Google hires idiots and even created a language for idiots. :))
Re:Go 1.10 Beta 1 is released by coldtea on Friday December 08, 2017 @07:46AM (#15878294)
You'll love Algol 68.
[dead]
Re:Go 1.10 Beta 1 is released by bespoke_engnr on Friday December 08, 2017 @11:35AM (#15879896)
I don't have the power to downvote but this comment has no place here. Please consider editing it.