C# futures: defer
-
-
It's not at the top of my list.
I wanna be a eunuchs developer! Pass me a bread knife!
-
-
static void Main() {
Console.WriteLine("Hello"); //1
defer {
Console.WriteLine("Foo"); //5
}
defer {
Console.WriteLine("Bar"); //4
}
defer {
Console.WriteLine("Baz"); //3
}
Console.WriteLine("World"); //2
}Gives: Hello World Baz Bar Foo (Obviously) I can only say: Wow! Just wow! No, hang on, I meant: Why!? Just why!? We seem to have gone from spectacularly minor gains to complete insanity. Please stop fixing a language that wasn't previously broken!
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
-
static void Main() {
Console.WriteLine("Hello"); //1
defer {
Console.WriteLine("Foo"); //5
}
defer {
Console.WriteLine("Bar"); //4
}
defer {
Console.WriteLine("Baz"); //3
}
Console.WriteLine("World"); //2
}Gives: Hello World Baz Bar Foo (Obviously) I can only say: Wow! Just wow! No, hang on, I meant: Why!? Just why!? We seem to have gone from spectacularly minor gains to complete insanity. Please stop fixing a language that wasn't previously broken!
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
Looks like a goto in a fancy dress.