Hacker News new | past | comments | ask | show | jobs | submit login

> Beyond that, you're inferring threading into the problem.

That's what I was thinking. There are no threads in the example.




But it's not at all unreasonable to think some newbie may come along, copy & paste that solution, and then call Shuffle from multiple threads.

Thread safety is something that needs to be touched on constantly, and it's smart to write your code such that it would be thread safe. Because otherwise, it just looks like a normal function call. And it could take someone ages to figure out why everything is breaking if they were to actually use that example.


The newbie just needs to try to use that code in any webapp. It will break. The answer is bad and needs to be downvoted.




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

Search: