API design note: Beware of adding an “Other” enum value (devblogs.microsoft.com)
from tedu@inks.tedunangst.com to inks@inks.tedunangst.com on 17 Mar 22:11
https://inks.tedunangst.com/l/5197

If you return WidgetFlavor::Mint, then this will confuse code written with the Version 1 API, because they expected to get Other for anything that isn’t vanilla, chocolate, or strawberry. The word “other” means “not mentioned elsewhere”, so the presence of an Other logically implies that the enumeration is exhaustive. On the other hand, you obviously should return WidgetFlavor::Mint because that’s why you added the value to the enum in the first place!

#intro-programming #type-system

#inks #intro-programming #type-system

threaded - newest