News for hackers. Stuff that matters.
Re:Go 2 Draft Designs by dangjc on Tuesday August 28, 2018 @02:41PM (#17861596)
I NEED generics to do any quantitative code. I evaluated Go for a project, and completely ruled it out because of this. You're unable to write an algorithm for float 32s and 64s, scalars vs vectors vs matrices, etc.

There might be a bias in the commentary because the membership of the Go community has self selected to just be those for whom the current constraints are feasible.

Re:Go 2 Draft Designs by majewsky on Tuesday August 28, 2018 @05:22PM (#17863026)
If you need a generic algorithm where the possible types are very finite (e.g. just float32 and float64, or just NxM matrices for N,M=1,...,4) you might be able to `go generate` the concrete implementations from a text template.
Re:Go 2 Draft Designs by jacques_chester on Tuesday August 28, 2018 @09:41PM (#17864638)
Text generation is fragile, error prone, does not play well with other type-based tooling, is difficult to upgrade, adds unnecessary busywork to the programmer's day.

When Java's limited, half-crippled version of generics showed up, sourcecode generation died. Pretty much overnight. Why doesn't anyone do it? Because it's a terrible experience compared to having types.

Re:Go 2 Draft Designs by giovannibajo1 on Tuesday August 28, 2018 @05:08PM (#17862896)
You won't be able to do numeric stuff with these proposals as well. You would still be missing operator overloading and parameter of integer types, which are the basis of any generic numeric code.
Re:Go 2 Draft Designs by garfij on Tuesday August 28, 2018 @11:27PM (#17865332)
True about no operator overloading, but that's just syntactical sugar for functions.

I believe you can get integer parameter types by using something like the `convertible` contract seen here https://go.googlesource.com/proposal/+/master/design/go2draf... (unless I'm mistaking what you are saying)

Re:Go 2 Draft Designs by sanxiyn on Wednesday August 29, 2018 @12:40AM (#17865686)
I believe you are mistaking. C++ allows things like std::array<int, 3>, where 3 is parameter of integer types.
Re:Go 2 Draft Designs by Shorel on Wednesday August 29, 2018 @12:52AM (#17865741)
And after that evaluation what did you use?
Re:Go 2 Draft Designs by foldr on Tuesday August 28, 2018 @05:41PM (#17863155)
Fortran does ok without generics.
Re:Go 2 Draft Designs by simias on Wednesday August 29, 2018 @03:44AM (#17866449)
So does C but you don't expect the same things from a language from the 70's. I don't think C or Fortran would be very popular if they were released today.
Re:Go 2 Draft Designs by yiyus on Wednesday August 29, 2018 @09:33AM (#17868068)
I won't argue with that, but I'd just like to say that the newest Fortran versions actually make a quite modern language.

Most of its quirks are related with compatibility with older versions. If a new version without that handicap was released today, it may look nicer than most people think.

Re:Go 2 Draft Designs by foldr on Wednesday August 29, 2018 @06:12AM (#17867074)
Sure, I'm not denying that generics are useful sometimes. It's just that people sometimes exaggerate how big of a problem it is not to have them.
Re:Go 2 Draft Designs by pjmlp on Tuesday August 28, 2018 @05:44PM (#17863180)
Re:Go 2 Draft Designs by foldr on Tuesday August 28, 2018 @06:08PM (#17863376)
>In Fortran 90, user-defined procedures can be placed in generic interface blocks. This allows the procedures to be referenced using the generic name of the block.

I don't know Fortran, but I'm fairly sure that you just googled "fortran generics" and pasted the first result without checking it :)

Re:Go 2 Draft Designs by pjmlp on Wednesday August 29, 2018 @03:14AM (#17866322)
Fortran got simplified generics in 2003, I pasted the wrong link by mistake.

https://cug.org/5-publications/proceedings_attendee_lists/20...

https://software.intel.com/en-us/node/692037

Re:Go 2 Draft Designs by foldr on Wednesday August 29, 2018 @06:11AM (#17867069)
Fair enough, I didn't know about that feature. However, people were using Fortran successfully for writing huge numeric libraries waaaaayyy before that.
Re:Go 2 Draft Designs by pjmlp on Wednesday August 29, 2018 @06:45AM (#17867190)
I was successfully using Z80, 68000 and 80x86 Assembly 30+ years ago as well.
Re:Go 2 Draft Designs by kown223 on Tuesday August 28, 2018 @05:56PM (#17863284)
can't you just use different names, algF32, algF64, really? is this the end of the world? No wander we have npm packages isEven and isOdd, sometimes you need to get yours hands dirty.