Live data from Hacker News

Expectations for generics in Go 1.18

groups.google.com

111–120 of 209 posts

Re: Expectations for generics in Go 1.18

#111

Earlier quoted context omitted.

Canadians now roll with the term Indigenous instead of Aboriginal

In 10 years a new word may become fashionable. Better to keep technical terms the same.

It's not about fashion, it's about cultural identity. I take it you don't see a problem with master/slave either?

Just do a find and replace, refactoring is easy and trying to argue on the internet about it is tiring.

Re: Expectations for generics in Go 1.18

#112

Thank god, this guy[0] can finally cut over to native generics in his code. [0]: https://www.reddit.com/r/rust/comments/5penft/parallelizing_...

It's funny how codegen has become widespread in Golang to work around its deficiency.

I've come to prefer code quantity over code complexity. I mean, what the fuck is

    def traverseImpl[F[_], A, B](fa: Option[A])(f: A => F[B])(implicit F: Applicative[F]) =
      fa map (a => F.map(f(a))(Some(_): Option[B])) getOrElse F.point(None)

Re: Expectations for generics in Go 1.18

#114
post #94

Earlier quoted context omitted.

Codegen is a super flexible and versatile tool, and simply having a strong generics feature does not mean you can avoid it: at $DAYJOB we use codegen even for C++ for e.g. grpc/openapi types, generating rapidjson streaming unmarshallers, etc not even counting Qt's moc/uic.

I understand and agree, I've run many a Java project that used codegen to emit Protobuf/Avro IDLs as types. But Go having actual generics, and accordingly removing some need for codegen, is not a bad thing at all.

No, I do believe Go will be improved if it allows library maintainers to implement some things like new collection types and utilities using generics.

I for one won't be using more advanced functional coding though, it's a lot more difficult to read / parse and the language is not designed with functional programming in mind. I'm sure people are already working on a functional programming library so you can do map / reduce / filter and the like, but readability and performance will be dreadful.

Re: Expectations for generics in Go 1.18

#115

Thank god, this guy[0] can finally cut over to native generics in his code. [0]: https://www.reddit.com/r/rust/comments/5penft/parallelizing_...

S̷͕͂̒c̴͉͈̆ŕ̶̘͚̄e̸̘̽̌ͅa̵̼̳͌m̷̬̓̈́͜s̴͙͆ ̸̨͓̾̈́i̴͈̼͐ņ̶̟̊̍ ̵͍̐̊Ű̸̪̤n̴̪̝̅̍i̶̜͌c̷͎̩̑̀ỏ̶̜͊d̴̟̎͠e̴̘̿ Oh gosh oh gosh zaglo variables please no

HE COMES

Re: Expectations for generics in Go 1.18

#116

> Because we will not know what the best practices are for using generics, Well, you could... take a look at languages created these past twenty years that support generics, learn lessons from that, and see how these lessons could apply to Go. But well, the Go team is not exactly known for paying much attention to the state of programming language theory, so I guess that's out.

It does seem strange. This is a problem that has been long solved elsewhere. I don't get the fuss over it.

Re: Expectations for generics in Go 1.18

#117
I'm glad that all the blog posts written by the apologetes and zealots, claiming that Go doesn't need generics and how they will actually be a detriment to the language, are archived somewhere in the wayback machines, so that they can't gaslight us into believing that they weren't just being silly for all this time.

Re: Expectations for generics in Go 1.18

#118
post #92

Earlier quoted context omitted.

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.

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.

> 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

#119
post #113
post #77

Earlier quoted context omitted.

Hopefully not and never.

They already have it with panic and recover. They just don't recommend using it for error handling.

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

#120
post #92

Earlier quoted context omitted.

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.

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.

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.
Post reply on HN