4 ms·
Not true. I count "new" being used about half as often as "&Point{}" in the Go standard library. That's not "practically unused". g% cg -c -f 'g/go/src/pkg.*
by rsc 13y ago
Not true. I count "new" being used about half as often as "&Point{}" in the Go standard library. That's not "practically unused".
g% cg -c -f 'g/go/src/pkg.*\.go' '\bnew\(' | total 2
1485
g% cg -c -f 'g/go/src/pkg.*\.go' '\&[A-Za-z0-9_.]+\{' | total 2
3051
g% cg -c -f 'g/go/src/pkg.*\.go' . | total 2
430482
g%
So 430,482 non-blank lines of code, 1485 lines with new, 3051 lines that look like a struct pointer literal.
- deleted 13y ago[deleted]
- trentmb 13y agoIf I had to guess, I think they meant that anyone writing new code will avoid using 'new'.