3 ms·
Cool. Do the pattern matching libraries check for exhaustiveness in the match cases? Do you see this eventually becoming part of the language?
by andrenth 8y ago
Cool. Do the pattern matching libraries check for exhaustiveness in the match cases? Do you see this eventually becoming part of the language?
- dom96 8y ago> Do the pattern matching libraries check for exhaustiveness in the match cases? I'm not 100% sure, but I would guess yes. > Do you see this eventually becoming part of the language? I can answer this with some confidence: no. Nim is designed to have a small but very extensible core via metaprogramming. This is why we encourage users to write such macros. They may end up in our stdlib eventually but it's unlikely they'll be part of the language.
- alehander42 8y agoAt least gara can't check exhaustiveness now: require one to add `else` to check all cases: it might be harder in general make sure branches match each possible value. However it should be possible for sum types/enums: `case` already does it