Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The code in this example is very easy to reason about. Because it's a single function.

If it's hard to reason about two different handles of shared data where one of them is used to modify the shared data... don't do that. append is for operating on a slice that your code is using exclusively. Like in this example, where it's all in the same function and the behavior's predictable.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: