logoalt Hacker News

Variadic Switch

40 pointsby Tschelast Tuesday at 8:45 PM3 commentsview on HN

Comments

david2ndaccountyesterday at 10:31 PM

In D, you can just do a static foreach over a sequence to generate case labels:

https://d.godbolt.org/z/PxWEW14K1

PeterWhittakertoday at 12:16 AM

I find the article very interesting and informative but, honestly, of all of the approaches, I find the basic switch to be the most readable and likely the most maintainable, at least for this case.