Go2

From Adam Colton
Jump to navigation Jump to search

What I would want in Go 2

Go 2

Append to nil map

should create the map, particularly useful in a struct.

Or better nil for defaults

It would be even better if no built-in types could be nil.

What is currently a nil slice would just be slice with both len and cap of 0. Same thing with a map - there is no nil map, just an empty map.

Most of the time this works fine, if you're really memory conscious about that overhead, you can use pointers to slices and maps.

Resolve Indirection Conflict

Give T where *T has Foo(), T will fulfill Fooer even though I can call T.Foo.

This is subtle and confusing.

Remove new

I don't think there's ever a good time to use it.

Read Only

https://github.com/golang/go/issues/20443

Not Go 2

(stuff that could be added without breaking backwards compatibility)

Package fulfills interface

A package behaves much like a struct - it's almost syntactically equivalent. For dependency management, it would be nice to use packages to fulfill interfaces.

Infinite Channels

There are cases where these are necessary. The