Y
Hacker News
new
|
ask
|
show
|
jobs
by
goodoldneon
329 days ago
Why is nominal typing desirable?
1 comments
jy14898
329 days 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
link
eyelidlessness
329 days 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).
link
veidr
329 days ago
unless... you know
link