logoalt Hacker News

sheepttoday at 9:26 AM1 replyview on HN

dictionaries generally aren't guaranteed to contain an entry for every possible value of the key type. while you could implement the colors example with a dictionary, ideally you'd want the type system to assure that given a Color, there will be a string associated with it


Replies

vips7Ltoday at 9:37 AM

Sounds like enums with extra steps.

show 2 replies