When it is known that there is already at least one element in the
list, it is awkwardly verbose to use three lines and an extra
variable declaration to remove the first or last item (a common
case), rather than use a simple expression.
a stack:
stk.PushFront(x)
x = stk.Front().Remove().(T)
vs.
stk.PushFront(x)
e := stk.Front()
e.Remove()
x = e.Value.(T)
[An alternative CL might be to add PopFront and PopBack methods].
R=gri
CC=golang-dev
https://golang.org/cl/3000041
Remove wasn't nil'ing the *Element.id. This property was exploited
by MoveToFront and MoveToBack internally, so I renamed the existing
Remove to "remove", and created an exported wrapper "Remove" that does
the right thing for the user's sake.
Also, saved an allocation by using *List as the id rather than *byte.
Fixes#1224.
R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/2685042
Package iterable has outlived its utility.
It is an interesting demonstration, but it encourages
people to use iteration over channels where simple
iteration over array indices or a linked list would be
cheaper, simpler, and have fewer races.
R=dsymonds, r
CC=golang-dev
https://golang.org/cl/2436041
parsing and printing to new syntax.
Use -oldparser to parse the old syntax,
use -oldprinter to print the old syntax.
2) Change default gofmt formatting settings
to use tabs for indentation only and to use
spaces for alignment. This will make the code
alignment insensitive to an editor's tabwidth.
Use -spaces=false to use tabs for alignment.
3) Manually changed src/exp/parser/parser_test.go
so that it doesn't try to parse the parser's
source files using the old syntax (they have
new syntax now).
4) gofmt -w src misc test/bench
1st set of files.
R=rsc
CC=agl, golang-dev, iant, ken2, r
https://golang.org/cl/180047
the bash scripts and makefiles for building go didn't take into account
the fact $GOROOT / $GOBIN could both be directories containing whitespaces,
and was not possible to build it in such a situation.
this commit adjusts the various makefiles/scripts to make it aware of that
possibility, and now it builds successfully when using a path with whitespaces
as well.
Fixes#115.
R=rsc, dsymonds1
https://golang.org/cl/157067
- enabled for function declarations (not just function literals)
- applied gofmt -w $GOROOT/src
(look for instance at src/pkg/debug/elf/elf.go)
R=r, rsc
CC=go-dev
http://go/go-review/1026006
container/list:
- change Iter to go over the list values
container/ring:
- add Iter, drop Forward/Backward
container/vector:
- add channel direction constraints
R=rsc,gri
APPROVED=rsc
DELTA=86 (23 added, 40 deleted, 23 changed)
OCL=33935
CL=34132