Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
sly010
on Aug 30, 2021
|
parent
|
context
|
favorite
| on:
In Go, pointers (mostly) don't go with slices in p...
Ok, I think I just understood the problem. The following would cause a problem:
s0 := append([]string{}, "zoo") sa := append(s0, "foo") sb := append(s0, "bar") // overwrites sa[1]
Go is truly unique in this sense, and you could not actually treat go slices as immutable structures. Point taken.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: