News for hackers. Stuff that matters.
Re:Proposal: Go 2: Lightweight anonymous function syntax by devnull3 on Sunday May 22, 2022 @10:40PM (#31474881)
Not that I have anything against or for this proposal, I think the focus should be on items which causes daily friction.

Example the err check pattern:

   val, err := f()
   if err != nil {
      return err
   }
Now to be fair this was discussed in public sometime back. I don't know what became of it.
Re:Proposal: Go 2: Lightweight anonymous function syntax by mdaniel on Sunday May 22, 2022 @11:37PM (#31475106)
Or `-Werror` that makes

    // given
    func Onoz() error { return errors.New("kaboom") }
    // when
    Onoz()
    // does not compile due to unhandled error
Golang has an existing syntax for purposefully eating errors via

    _ = Onoz()
but I've caught innumerable bugs in codebases where the author didn't realize (or care?) that funcs returned error and just swallowed it

For a language where an _unused import_ is a compilation error, surely either making error swallowing also a compile error, or (as opt-in behavior) using -Werror as with gcc to say, "no, seriously: no error swallowing permitted"

It might require some silliness given the "vendor deps" pattern, but then again, if one of your deps is also careless, maybe that's _exactly_ the circumstances under which you'd want to call timeout

Re:Proposal: Go 2: Lightweight anonymous function syntax by morelisp on Monday May 23, 2022 @02:20AM (#31475854)
The equivalent of '-Werror' in go is using linters, which will detect that.
Re:Proposal: Go 2: Lightweight anonymous function syntax by mdaniel on Monday May 23, 2022 @11:51AM (#31480591)
I have seen no such linter[0]; do you have one that you know does that?

But, sure, A++ for having to install more stuff when the go compiler considers a different "linter" problem as fatal to the build

0: yes, of course GoLand catches it but prying vim from gophers hands is hard work

Re:Proposal: Go 2: Lightweight anonymous function syntax by morelisp on Monday May 23, 2022 @01:28PM (#31482064)
https://github.com/kisielk/errcheck, which is in most of the combined linter packages by default.

We'll agree to disagree about unused imports; imports have can side-effects.

Re:Proposal: Go 2: Lightweight anonymous function syntax by everforward on Monday May 23, 2022 @12:18AM (#31475319)
This doesn't really seem worth it to me. There just aren't enough extraneous characters. We can drop the `func`, but most of the others are near equally long or exclude information like return types. Making return types implicit seems like a much larger language change.
Re:Proposal: Go 2: Lightweight anonymous function syntax by erik_seaberg on Monday May 23, 2022 @01:20AM (#31475558)
I’m always surprised to see “beginners will need to learn it” as an argument when so much of what I had to learn once has kept paying off for years. I say give me the biggest toolbox we have.
Re:Proposal: Go 2: Lightweight anonymous function syntax by throwaway81523 on Monday May 23, 2022 @03:54AM (#31476334)
Go 2 is a thing? Is it considered harmful?
Re:Proposal: Go 2: Lightweight anonymous function syntax by metaltyphoon on Sunday May 22, 2022 @09:47PM (#31474596)
“Go 2” is a pipedream. It won’t happen
Re:Proposal: Go 2: Lightweight anonymous function syntax by Matthias247 on Monday May 23, 2022 @12:48AM (#31475423)
Are the recently introduced generics part of Go 2 - or not? I thought at one point in time the team announced that Go 2 would always be a backwards compatible evolution of the language, so it seems new features could happen independent of whether one labels them as Go or Go 2.
Re:Proposal: Go 2: Lightweight anonymous function syntax by morelisp on Monday May 23, 2022 @02:38AM (#31475945)
Both generics and the errors.Is/errors.As interface began life as "Go 2" projects. "Go 2" is a catch-all bucket for anything that might need to be incompatible.
Re:Proposal: Go 2: Lightweight anonymous function syntax by metaltyphoon on Monday May 23, 2022 @10:38PM (#31487424)
Right... so there is no Go 2. It's silly for a language that prides so much on semver and how its package versioning uses it, to make "Go 2" backwards compatible.
Re:Proposal: Go 2: Lightweight anonymous function syntax by morelisp on Tuesday May 24, 2022 @02:03AM (#31488530)
"Go 2" is not backwards compatible. Features planned for "Go 2" which are backwards compatible get backported to Go 1. This is aligned with semver.
Re:Proposal: Go 2: Lightweight anonymous function syntax by armchairhacker on Sunday May 22, 2022 @10:00PM (#31474659)
C++ should be renamed to "Go 18465927"
Re:Proposal: Go 2: Lightweight anonymous function syntax by alophawen on Sunday May 22, 2022 @09:50PM (#31474617)
Go on
Re:Proposal: Go 2: Lightweight anonymous function syntax by genericone on Sunday May 22, 2022 @10:02PM (#31474672)
The Goto Language.