News for hackers. Stuff that matters.
Re:Expectations for generics in Go 1.18 by awestroke on Thursday October 28, 2021 @01:59AM (#29022870)
And so Go is one step closer to being a real programming language in many people's eyes.
Re:Expectations for generics in Go 1.18 by throwaway894345 on Thursday October 28, 2021 @08:27AM (#29025255)
It seems eminently foolish to think Go isn’t a “real language” for lack of generics—why should we concern ourselves about fools’ opinions?
Re:Expectations for generics in Go 1.18 by shakezula on Thursday October 28, 2021 @02:48AM (#29023137)
Saying this about one of the fastest growing languages on the scene right now feels… weird?
Re:Expectations for generics in Go 1.18 by valenterry on Thursday October 28, 2021 @03:16AM (#29023321)
I would say, many people also look down on much more popular languages, such as PHP. Go is still an absolute niche language, even more niche than languages like Scala or R.
Re:Expectations for generics in Go 1.18 by sph on Thursday October 28, 2021 @03:21AM (#29023345)
Niche in your niche perhaps, but there's a lot of code in the wild written in Go. Hell, all the modern devops tools are written in Go (Docker, k8s & co.)

Meanwhile, as a non Java programmer, I've never seen a Scala app. I know about R, but nothing on my PC is written in it.

Agreed that PHP is massive in comparison to all of them.

Re:Expectations for generics in Go 1.18 by valenterry on Thursday October 28, 2021 @04:58AM (#29023897)
Sure, devops tools are usually more fundamental, whereas high level languages are used for things closer to the business. Twitter's backend for example is mainly powered by Scala, but you probably don't know about it, because it is not as visible to you.
Re:Expectations for generics in Go 1.18 by throwaway894345 on Thursday October 28, 2021 @08:25AM (#29025229)
Enumeration isn’t a compelling way to indicate relative frequency (in this case, frequency of usage of Go and Scala, respectively). An enumeration of size=1 is even less convincing.
Re:Expectations for generics in Go 1.18 by valenterry on Thursday October 28, 2021 @09:31AM (#29025895)
That was not my intention. The example was supposed to show that not all software has the same visibility to software-developers.
Re:Expectations for generics in Go 1.18 by buzer on Thursday October 28, 2021 @04:11AM (#29023604)
> Meanwhile, as a non Java programmer, I've never seen a Scala app.

One widely known Scala application is Kafka. Some parts of it are in Java, but actual core is still mainly Scala afaik.

Re:Expectations for generics in Go 1.18 by _hzrk on Thursday October 28, 2021 @05:46AM (#29024112)
Yep, Kafka is probably the most popular one. I've heard that the team is looking forward to replace the remaining Scala code in the project with Java once pattern matching and co. land. Spark is another beast that was written in Scala. Many are reporting a high cost for compatibility. Nowadays, Scala community is all about Typelevel and ZIO, if you are not a category theory minded person, then you will have a hard time picking it up.
Re:Expectations for generics in Go 1.18 by eweise on Thursday October 28, 2021 @09:00AM (#29025553)
Zio's library is not based on category theory. In fact, its trying to be the opposite.
Re:Expectations for generics in Go 1.18 by _hzrk on Thursday October 28, 2021 @07:31PM (#29033413)
Re:Expectations for generics in Go 1.18 by im3w1l on Thursday October 28, 2021 @04:54AM (#29023876)
> I know about R, but nothing on my PC is written in it.

You could say the same thing about excel macros. They are both tools for wrangling data, tools that will typically not be distributed to end users.

Re:Expectations for generics in Go 1.18 by nprateem on Thursday October 28, 2021 @02:07AM (#29022903)
For the love of God please let throwable and catchable exceptions be next
Re:Expectations for generics in Go 1.18 by konart on Thursday October 28, 2021 @02:38AM (#29023074)
Hopefully not and never.
Re:Expectations for generics in Go 1.18 by kubb on Thursday October 28, 2021 @04:46AM (#29023828)
They already have it with panic and recover. They just don't recommend using it for error handling.
Re:Expectations for generics in Go 1.18 by chairmanwow1 on Thursday October 28, 2021 @04:57AM (#29023895)
Even if this behavior is similar to how Java exceptions work, I love the way go packages are written.

Explicit error handling can be tedious, but I’m never confused about what some code will do.

Compared to Java where an exception may bubble up 10 layers to a catchall try catch statement, I actually know where the error is coming from.

Would be nice to have this abstracted away with tooling though. I would imagine go generate could be used to great effect in this arena.

Re:Expectations for generics in Go 1.18 by julik on Thursday October 28, 2021 @08:04AM (#29025051)
Go errors are actually less useful in this case since they do not capture backtraces by default (if I remember well), and invite gratuitous re-wrapping. Most times I had to troubleshoot something it was useful to know the lowest level where the error happened, not the arbitrary level the application/library author decided to be appropriate and missed.
Re:Expectations for generics in Go 1.18 by throwaway894345 on Thursday October 28, 2021 @08:32AM (#29025294)
Agreed, there are tradeoffs, but at least Go’s approach has more potential—there’s nothing stopping Go from capturing stack traces and returning them on the error object. On the other hand, exceptions always have the confusing control flow problem.
Re:Expectations for generics in Go 1.18 by kubb on Thursday October 28, 2021 @06:21AM (#29024297)
I'm just stating a fact, it's slightly unnecessary to reply with your declaration of love for Go.

I prefer returning errors as a part of the function result myself, as you would in any decent language encouraging functional programming principles.

If anything, it shows that including a feature in a language (exceptions) will not lead to people misusing it if that misuse is not encouraged.

Re:Expectations for generics in Go 1.18 by konart on Friday October 29, 2021 @08:15AM (#29037562)
...because panic and recovery is a whole different plane of existence. Recovery feature is a needed evil here, needless for a simple error handling.
Re:Expectations for generics in Go 1.18 by grey-area on Thursday October 28, 2021 @02:51AM (#29023157)
Hopefully they will never introduce commonplace exceptions.
Re:Expectations for generics in Go 1.18 by kervantas on Thursday October 28, 2021 @03:02AM (#29023235)
Please dont.