Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace []Issue with []*Issue #180

Closed
rsc opened this issue Apr 9, 2015 · 2 comments
Closed

replace []Issue with []*Issue #180

rsc opened this issue Apr 9, 2015 · 2 comments
Assignees

Comments

@rsc
Copy link
Contributor

rsc commented Apr 9, 2015

In general having slices of large structs is awkward because it means that when you range over the slice, you either have to write:

for i := range list {
    x := &list[i]
    ...
}

or you write

for _, x := range list {
    ...
}

and put up with the fact that (1) the iteration is doing a (more expensive than pointer copy) struct copy for each element and (2) you cannot modify the elements by changing x, since x is a copy.

If list were a []*github.Issue it wouldn't have these problems.

The encoding/json package can handle slices of pointers just fine, but changing the types would have the drawback of breaking existing clients.

@gmlewis
Copy link
Collaborator

gmlewis commented Jun 17, 2016

While scanning through the old issues, I just found this one and think it is worthwhile doing since this package is frequently handling slices of large structs.

I'm thinking that the impact on existing clients will be negligible due to the nice inference properties of Go.

@willnorris and @shurcooL - I would like to do this... any objections?

@gmlewis gmlewis self-assigned this Jun 17, 2016
gmlewis added a commit to gmlewis/go-github that referenced this issue Jun 17, 2016
Note that this is an API-breaking change but should have minimal
impact on users of this package due to the nice inference
properties of the Go programming language.

Fixes google#180.

Change-Id: Ib386135e6b8f306d1f54278968c576f3ceccc4e7
gmlewis added a commit to gmlewis/go-github that referenced this issue Jun 17, 2016
Note that this is an API-breaking change but should have minimal
impact on users of this package due to the nice inference
properties of the Go programming language.

Fixes google#180.

Change-Id: Ib386135e6b8f306d1f54278968c576f3ceccc4e7
@dmitshur
Copy link
Member

SGTM. This looks like an improvement, and updating for API change is easy (in most cases, no changes need to be done).

gmlewis added a commit to gmlewis/go-github that referenced this issue Jun 17, 2016
Note that this is an API-breaking change but should have minimal
impact on users of this package due to the nice inference
properties of the Go programming language.

Fixes google#180.

Change-Id: Ib386135e6b8f306d1f54278968c576f3ceccc4e7
gmlewis added a commit to gmlewis/go-github that referenced this issue Jun 17, 2016
Note that this is an API-breaking change but should have minimal
impact on users of this package due to the nice inference
properties of the Go programming language.

Bumped `libraryVersion` to 0.2 due to API-breaking change as
discussed in google#376.

Fixes google#180.

Change-Id: Ib386135e6b8f306d1f54278968c576f3ceccc4e7
gmlewis added a commit to gmlewis/go-github that referenced this issue Jun 20, 2016
Note that this is an API-breaking change but should have minimal
impact on users of this package due to the nice inference
properties of the Go programming language.

Bumped `libraryVersion` to `2` due to API-breaking change as
discussed in google#376.

Fixes google#180.

Change-Id: Ib386135e6b8f306d1f54278968c576f3ceccc4e7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants