Yesterday, I wanted to show someone how CallCC works in C#/async, but I couldn’t find any examples in my web search results. C#/async has been out in the world for some time, I’d be surprised if this hasn’t been done before, but just in case here’s a quick implementation.
Continue reading “A little Call/cc in C#”
Anders Hejlsberg talking on the new C# and VB features for the version to follow C# 4.0 (timecode 48:10):
[Async methods] allow you to compose asynchronous stuff using normal flow of control and using all of the statements that you know already.
Pretty sweet. The first (longer) portion of the presentation is on the new asynchronous programming features for C# and VB. A hidden gem at the end (starting at timecode 50:40) is the “Compiler as a Service” status report. They’re experimenting with providing compiler front end, back end, and intermediate transformations as a run-time library.
It’s curious that there was no mention of the async transformations (first section) during his discussion of general purpose syntax transformations (second section). It would be interesting to see whether the “Compiler as a Service” libraries provide sufficient support as to be able to extend C# with things like ‘iterator syntax’ or ‘async methods’, without having to wait for a new compiler.
(A nod of course to Lisp’s macros, Scheme’s continuations, and Haskell’s use of monads; for defining new control flow primitives)
Just a quick post, haven’t shared anything in a while, but found this discussion on loop variables and closures interesting — well, inflammatory, actually.
Continue reading “Loop variable closure semantics”