top | item 44599982

(no title)

goodoldneon | 7 months ago

Why is nominal typing desirable?

discuss

order

jy14898|7 months ago

example:

  type FireNuke = boolean;
  type DontFireNuke = boolean;
  function perhapsFireNuke(action: FireNuke);
you wouldn't want to call perhapsFireNuke with DontFireNuke, even though the types are compatible

eyelidlessness|7 months ago

To be fair, this is a better example of booleans being a poor fit for modeling many problems. And it’s solvable without even addressing either issue (eg how this is modeled in the real world with multiple affirmatives).

veidr|7 months ago

unless... you know