Hacker News new | ask | show | jobs
by johncolanduoni 3998 days ago
> I'm not sure. Void is not a real value, whereas unit is (unlike the article states) just a normal value, which supports all the things you can do with values, like assigning/let-binding etc.

This is true, but null is effectively at the bottom of the inheritance hierarchy in that it is a valid value for any (pointer) type (in C/C++/Java etc.), while unit cannot be used that way. The relationship between unit and void is that if you were porting a program from an imperative language with void to OCaml, you would generally replace any place where you returned void or took no arguments/void as the argument with unit. Like void it conveys no real information.