3 ms·
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
by sph 4y ago
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.
- attrutt 4y agoThe 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.
- sph 4y agoI 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.