Browse by Tags

Tagged Content List
  • Blog Post: Asynchrony in C# 5, Part Three: Composition

    I was walking to my bus the other morning at about 6:45 AM. Just as I was about to turn onto 45th street, a young man, shirtless, covered in blood ran down 45th at considerable speed right in front of me. Behind him was another fellow, wielding a baseball bat. My initial thought was "holy goodness, I...
  • Blog Post: Asynchronous Programming in C# 5.0 part two: Whence await?

    I want to start by being absolutely positively clear about two things, because our usability research has shown this to be confusing. Remember our little program from last time? async void ArchiveDocuments(List<Url> urls) { Task archive = null; for(int i = 0; i < urls.Count; ++i) { var document...
  • Blog Post: Continuation Passing Style Revisited Part Five: CPS and Asynchrony

    Today is when things are going to get really long and confusing. But we'll make it through somehow. Consider the following task: you’ve got a list of URLs. You want to fetch the document associated with each URL. (Let’s suppose for the sake of argument that this always succeeds.) You then want to make...
  • Blog Post: Continuation Passing Style Revisited Part Four: Turning yourself inside out

    The obvious question at this point is: if CPS is so awesome then why don’t we use it all the time? Why have most professional developers never heard of it, or, those who have, think of it as something only those crazy Scheme programmers do? First of all, it is simply hard for most people who are used...
  • Blog Post: Continuation Passing Style Revisited Part Three: Musings about coroutines

    Last time I sketched briefly how one might implement interesting control flows like try-catch using continuations; as we saw, the actual implementations of Try and Throw are trivial once you have CPS. I'm sure that you could extend that work to implement try-catch-finally. Or, another basic exercise...
  • Blog Post: Continuation Passing Style Revisited Part Two: Handwaving about control flow

    Last time on Fabulous Adventures: “ But we can construct arbitrarily complex control flows by keeping track of multiple continuations and deciding which one gets to go next. ” Let’s look at an example of something more complex than a conditional. Consider a simplified version of “try-catch”, where there...
  • Blog Post: Continuation Passing Style Revisited, Part One

    Good morning fabulous readers, let me just start by saying that this is going to get really long and really complicated but it will all pay off in the end. I’m also going to be posting on an accelerated schedule, more than my usual two posts per week. (It’ll eventually become clear why I'm doing all...
  • Blog Post: Iterator Blocks, Part One

    There is a constant tension in language design between solving general problems and solving specific problems; finding the right spot on the general-to-specific spectrum can be quite tricky. The design of iterator blocks yields (ha ha) a germane example. At almost every step along the way, there are...
  • Blog Post: Recursion, Part Six: Making CPS Work

    JScript doesn't support CPS natively but we can write another dispatch engine that makes it work. There's only ever one active continuation, so lets have a new rule: JScript CPS functions are allowed to return, but the last thing that they do must be to tell our dispatch engine what the continuation...
  • Blog Post: Recursion, Part Five: More on CPS

    Suppose we wanted to write this by-now-familiar little function in continuation passing style: function treeDepth(curtree) { if (curtree == null) return 0; else { var leftDepth = treeDepth(curtree.left); var rightDepth = treeDepth(curtree.right); return 1 + Math.max(leftDepth, rightDepth); } } ...
  • Blog Post: Recursion, Part Four: Continuation Passing Style

    We're getting hung up on the stack management aspects of recursive programming. Why do we need a stack at all? What purpose does it serve? If you're like most developers, you probably learned about subroutines and functions at an early age. The idea is pretty straightforward. You stop what you're...
Page 1 of 1 (11 items)