]> Cypherpunks repositories - gostls13.git/commit
container/list: Correctly maintain internal invariants
authorRobert Griesemer <gri@golang.org>
Fri, 28 Sep 2012 17:35:32 +0000 (10:35 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 28 Sep 2012 17:35:32 +0000 (10:35 -0700)
commit0e9daef2d1c4d6dfc0c37386c5affaec370fa99e
tree934834699ee49ab22c5d177f4fa642d5a278a7be
parent6ed800c01d0587413b9d103ea939f406e5e85efc
container/list: Correctly maintain internal invariants

The previous implementation was a mess with invariants
maintained inconsistently. Essentially reimplemented
the package:

- used a circular list as internal representation for
  significantly simpler implementation with fewer
  special cases while maintaining the illusion of
  a nil-terminated doubly linked list externally

- more precise documentation

- cleaned up and simplified tests, added test case
  for issue 4103.

No changes to the API or documented semantics.

All this said, I would be in favor of removing
this package eventually. container/ring provides
a faster implementation and a simpler and more
powerful API.

Fixes #4103.

R=r
CC=golang-dev
https://golang.org/cl/6569072
src/pkg/container/list/list.go
src/pkg/container/list/list_test.go