logoalt Hacker News

ivanjermakovlast Sunday at 9:52 PM1 replyview on HN

If I understood `abort` semantics correctly, it has a type of `never` or Rust's `!`. Which has a meaning "unobtainable value because control flow went somwhere else". `void` is closer to `unit` or `()` because it's the type with no allowed values.

Cool trick: some languages (e.g. TypeScript) allow `void` generics making parameters of that type optional.


Replies

steveklabniklast Sunday at 11:12 PM

Unit has exactly one allowed value.

show 1 reply