I just noticed that ECMAScript for XML is now a standard.
It gives me the jeebies that XML should become a native data type in a programming language. Though, the statement I just made is sloppy because not only is the data type XML's "Infoset", not "XML" itself, but adding the Infoset to the language is only one of the pieces. The other is that you can represent XML itself natively in the language by actually typing XML code that the language recognizes, parses, and then represents as an Infoset or whatever.
Surprisingly, I think this continuation sandwich example (via the Perl 6 summary) has been more helpful in helping me understand continuations than anything else I've read so far. I already had a half-understanding, and this pushed me over to a three-quarters-understanding.
My understanding of continuations stands as follows: With closures, you create a function that wraps any lexicals in scope at the time which then travel along with the function wherever it goes. A continuation is similar, except rather than operating within the scope of a function, it operates on the scope of the entire program, wrapping all program state and carrying it around with it.
My main problem up until now has been that "The continuation can't just save all data associated with the program, that's crazy!". So I assume it must be part of some kind of copy-on-write scheme, where a continuation (probably similar to how closures wrap their lexicals) references the same variables as the main program does until one of those variables changes in the main program or in the continuation, at which point someone splits off a new variable that has the new value and is separate from the old variable.
The only issue is that I don't understand how this would work. Say you save 5 continuations at some point in the program. If you change a variable inside one of the continuations it splits off a new variable and doesn't share the same variable with the other four anymore. But, is the main program sort of like its own continuation, so if you change a variable in the main program it splits off a brand new one for itself? Furthermore, won't each of the 5 continuations have each of the preceeding continuations in its scope, and won't you therefore get really weird and complex cascading changes if you change something in one of the continuations around? Or, I suppose, it would do copy-on-write with the whole continuation? How the heck can the program reference everything without taking up gobs of memory? Finally, doesn't this take all kinds of complex program analysis to find out what changes and what doesn't in order to implement continuations efficiently?
Update: I asked for help over at Lambda the Ultimate and I've gotten at least one helpful response.
Update: Ian's written stuff on his weblog about this.
I'd just like to point out that I was right about Joe Wilson. Not that it was very hard to figure out. Previous posts here and here.
Update: Glenn Reynolds has more links. Oh, and this from earlier.
Girls, please don't get breast implants
Wow... I'm almost embarrassed toadmit I'm a member of the femalegender, a...
Proud B-Cup: Aug 16, 2:59am