Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This inline else example makes sense when you stop and think what it is doing, but it is in no way intuitive.

Taken at face value, why is it switching on self with no case whatsoever? Why does the else case need to be inlined? This is trying to be smarter than it needs to be.

Meh, not a fan.



The fact that you ask why it needs to be inlined means you haven't understood how the feature works. If you did, you'd be a fan. It's a general mechansim that fits Zig perfectly, along with inline for and while.


I understood why. I said it is very non-obvious and opaque at first read, so it might trip up a lot of newcomers.

Surely there's better ways to express interfaces than exploiting a brilliant side-effect of compile time inlining.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: