C# Lowering #42
Replies: 6 comments 38 replies
-
|
Curious where the term 'Lowering' came from? If Syntactic Sugar == Lowering why rebrand? |
Beta Was this translation helpful? Give feedback.
-
|
Here's a library that rewrites certain C# constructs: https://github.com/ShiftLeftSecurity/SharpSyntaxRewriter |
Beta Was this translation helpful? Give feedback.
-
|
I highly recommend knowing what the IL looks like for various spoonfuls of syntactic sugar. For example, I do that, and that is why I do not use "using", but use try-catch-finally, which gives better exception control and does not swallow the using object's constructor exception. But, if the syntactic sugar and the "lowering" process yield the same IL, then just use the syntactic sugar, as there is no advantage to "lowering". |
Beta Was this translation helpful? Give feedback.
-
|
I'm wondering why is the array copied in the 2nd example? Is that to ignore changes that may be done in the original array in multi-threading code? |
Beta Was this translation helpful? Give feedback.
-
|
Why is everyone so obsessed about syntactic sugar? All control structures beyond if and while are syntactic sugar. You could write every program in them. That is the essence of turing completeness. |
Beta Was this translation helpful? Give feedback.
-
|
How is |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
C# Lowering
Did you ever hear the word "compiler magic" or "syntactic sugar"? Probably yes and therefore we want to dissect what this "magic" really is!
We can see how we can predict performance or bugs by "lowering" our code. Also we will see how things like foreach, var, lock, using, async, await, yield, anonymous types, record, stackalloc, pattern matching, Blazor components, deconstructor, extension methods... do not really exist.
https://steven-giesel.com/blogPost/69dc05d1-9c8a-4002-9d0a-faf4d2375bce
Beta Was this translation helpful? Give feedback.
All reactions