3 ms·
> P.S. I still don't understand the reasoning behind "blocks have return values". Does any popular programming language out there do this except maybe some of t
by comex 6y ago
> P.S. I still don't understand the reasoning behind "blocks have return values". Does any popular programming language out there do this except maybe some of the ML-derived ones?
Most languages have something like `cond ? expr1 : expr2` which would naturally compile to an if-else block with a return value.
- kevingadd 6y ago'if' is a separate instruction from 'block' in wasm, though - the conditional having a return value makes sense given that there are two paths it can take and a value might want to flow out. the logic behind applying that to all basic blocks is confusing to me.