DEV Community

Discussion on: Language Proposal: The 'Any' Switch Case

Collapse
 
nektro profile image
Meghan (she/her)

Ooo, I like this! I thought about putting it before and after, and I love the addition of the middle block. But I worried about the readability of this. Since it begs the question, at least at this stage, does the middle bottom any run after 1,2,3,4 or just cover 3,4?

Collapse
 
megazear7 profile image
megazear7

I think it would just have to just be specified by the language. I'm not coming up with anything that wouldn't add a bunch of lexical complexity.

This does remind me though, when you have increasingly complex relationships between data and behavior, at some point it's best to abstract that into it's own class that can encapsulate that logic so that the language doesn't have to make increasingly strong opinions on how those relationships are expressed.