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

> "They are probably not called ADD and SUBTRACT for a reason."

You'll be pleased to know they aren't called that in the protocol, but they actually are that. They take a delta value so you can do "incr 5" to add 5 and internally the function is named "add_delta" not "incr"[1]. (Beware because it's not quite subtraction, going negative is forbidden. (3 + 5 - 5 == 3) but (3 - 5 + 5 == 5)).

[1] which means the answer in the followup blog post (and my answer) to overload the same function to handle multiplication as well makes the function name even less accurate.



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

Search: