Live data from Hacker News

Go 2, here we come

blog.golang.org

261–270 of 534 posts

Re: Go 2, here we come

#261

Am I reading this right that the list in the #Proposals header are the only proposals from the Go2 bucket that are being considered for 1.13? I was hoping "check" would make the cut.

Yup. Specifically because they are backwards compatible and well known problems being used to test their proposal feedback system.

Re: Go 2, here we come

#262
I'm learning Go, just a naive question, why does Go put the variable type at the end of declaration, is this an absolute need? no other widely usage language does that, and it just feels odd to me.

Re: Go 2, here we come

#263
post #262

I'm learning Go, just a naive question, why does Go put the variable type at the end of declaration, is this an absolute need? no other widely usage language does that, and it just feels odd to me.

Pascal did it:

     procedure SetColor
         (const NewColor: TColor; const NewFPColor: TFPColor); virtual;
Rust does it too:

   fn do_twice(f: fn(i32) -> i32, arg: i32) -> i32
Go is similar, but less symbols:

   f func(func(int,int) int, int) func(int, int) int

Re: Go 2, here we come

#264
post #262

I'm learning Go, just a naive question, why does Go put the variable type at the end of declaration, is this an absolute need? no other widely usage language does that, and it just feels odd to me.

A lot of languages have had type declarations at the end. The first popular which comes to mind is Pascal (see http://wiki.freepascal.org/Fibonacci_number).

You get used to it. Having to deal with this kind of differences between different programming languages is a lesser concern in the grand scheme of things.

Re: Go 2, here we come

#265
post #262

I'm learning Go, just a naive question, why does Go put the variable type at the end of declaration, is this an absolute need? no other widely usage language does that, and it just feels odd to me.

Pascal did it: procedure SetColor (const NewColor: TColor; const NewFPColor: TFPColor); virtual; Rust does it too: fn do_twice(f: fn(i32) -> i32, arg: i32) -> i32 Go is similar, but less symbols: f func(func(int,int) int, int) func(int, int) int

Also Scala, Haskell, TypeScript, Swift, Kotlin, Visual Basic, Python (PEP 526), and many others.

Re: Go 2, here we come

#266
post #93

Earlier quoted context omitted.

I really don't know why you got downvoted. The fact that go was meant to force "average" programmers produce maintainable code is an extremely important push for the language. I do think that generics are needed if go wants to become more useful in contexts others than network middleware or data plumbing, but i'm also pretty sure that adding them will help cripple a lot of codebase in a very short term.

Is there a definitive source for the "average" programmers target? I'd always considered it a tongue-in-cheek response to architecture astronauts who sneer at Go's simplicity.

“The key point here is our programmers are Googlers, they’re not researchers. They’re typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. They’re not capable of understanding a brilliant language but we want to use them to build good software. So, the language that we give them has to be easy for them to understand and easy to adopt.”

-- Rob Pike

From https://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2014/Fr...

And there are other hints on https://talks.golang.org/2012/splash.article

Re: Go 2, here we come

#267

Earlier quoted context omitted.

For the first round they are testing the GO 2 selection process by applying it to proposed changes for 1.13, which limits it to non-breaking proposals. It won't get interesting until they start selecting breaking proposals.

It won't get interesting until they start selecting breaking proposals. From what I see in the past couple of decades in popular languages, is there really a justification for breaking changes, from the POV of project maintainers?

.net 2.0 had breaking changes, and it was absolutely justified. The ecosystem would not be where it is now without it. (.net 2.0 introduced reified generics, and required a major overhaul of the internals, with quite a bit of breaking changes)

Re: Go 2, here we come

#268

Earlier quoted context omitted.

It may be crazy but it's not exactly without precedent. Neither C nor C++ fix the sizes of the fundamental integer types, although for backward-compatibility reasons popular 64-bit platforms still have 32-bit `int` and even `long`. But yeah, there's a reason eg. Rust has no `int` and friends but `i32` etc. instead.

Rust has a `usize` which is 32 or 64 bits depending on the platform and also serves as the native index type for arrays and such.

Yeah, that makes sense because you need some type to span the address space and that depends on the size of the address space. That is what int is used for in go, though why they chose signed rather than unsigned is confusing. unsigned you would never have to do negative bounds checks and you can prove a lot of other useful things if you know your index is always positive.

Re: Go 2, here we come

#269
post #135
post #35

I'm curious if making go an ISO standard was ever considered.

Given that go is already pretty well specified (and, perhaps more importantly, has 2 mature implementations) it's hard to see what advantages having it formally standardised would bring. https://golang.org/ref/spec

With Go 2, they are moving to a community run project. ISO is a process for that. I guess, why reinvent the wheel unless they think they can do substantially better.

Re: Go 2, here we come

#270
post #255

Earlier quoted context omitted.

It's a rational practice when your language allows casting pointers to integers. Since the size of the pointer itself will vary based on the underlying architecture, you need an integer type which will also vary based on the underlying architecture.

I feel you, but, that's uintptr. int is more useful as the "native type" for array/slice length/cap/indexing

Except length/cap/index are always positive, so I think int was a mistake here.
Post reply on HN