4 ms·
There's a bytecode representation already - you can use it when compiling to IL: https://docs.microsoft.com/en-us/dotnet/api/system.linq.expressions.blockexpres
by zmj 8y ago
There's a bytecode representation already - you can use it when compiling to IL: https://docs.microsoft.com/en-us/dotnet/api/system.linq.expressions.blockexpression?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.linq.expr...
What's missing is a way to express an anonymous block expression in C#. I'm not sure that's a gap worth filling, though - if the logic is worth a block, isn't it worth a name?
- twhb 8y ago“If” statements and loops already make use of anonymous blocks, and I think serve as ample demonstration that, no, not all blocks are better off named. What’s missing is the ability to use those blocks wherever an expression is expected.