7 ms·
And so Go is one step closer to being a real programming language in many people's eyes.
by awestroke 5y ago
And so Go is one step closer to being a real programming language in many people's eyes.
- nprateem 5y agoFor the love of God please let throwable and catchable exceptions be next
- konart 5y agoHopefully not and never.
- kubb 5y agoThey already have it with panic and recover. They just don't recommend using it for error handling.
- chairmanwow1 5y agoEven 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.
- kubb 5y agoI'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.
- julik 5y agoGo 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.
- throwaway894345 5y agoAgreed, 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.
- konart 5y ago...because panic and recovery is a whole different plane of existence. Recovery feature is a needed evil here, needless for a simple error handling.
- grey-area 5y agoHopefully they will never introduce commonplace exceptions.
- kervantas 5y agoPlease dont.
- shakezula 5y agoSaying this about one of the fastest growing languages on the scene right now feels… weird?
- valenterry 5y agoI 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.
- sph 5y agoNiche 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.
- buzer 5y ago> 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.
- _hzrk 5y agoYep, 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.
- eweise 5y agoZio's library is not based on category theory. In fact, its trying to be the opposite.
- throwaway894345 5y agoIt seems eminently foolish to think Go isn’t a “real language” for lack of generics—why should we concern ourselves about fools’ opinions?