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

Think of types more as physical units to check your calculation. The position on a chess board and on a checker board are both 2d integer vectors but you might or might not want them able to be summed together, the same way that 5 liters and 5 grams are both real numbers but should not be summed.


So if your algorithm counts apples and counts pears, those wouldn't both have the type "integer". Far from it. They would have the types "number of apples" and "number of pears".




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

Search: