call/cc and ecmascript

I suppose it should have been obvious, but I was still delightfully surprised when Clinton Ebadi came up with these lines on IRC this morning:

ecmascript@(guile-user)> var callcc = this['call/cc'];
ecmascript@(guile-user)> var k = false;
ecmascript@(guile-user)> 1 + callcc (function (kont) { k = kont; return 0; });
1
ecmascript@(guile-user)> k (2);
3

42 good times indeed!

5 responses

  1. wingo says:

    Hum, that pre-formatted text looks pretty terrible, overflowing through the navigation box thing. I suppose I should fix the stylesheet somehow. Does someone have a clever idea about how to do that?

  2. Dan says:

    I don't think that there is a good way to avoid floats, as far a pre is conserned, the two goals are mutually exclusive. I would at least make the pre overflow: auto so that it does not spill out of the parent.

    Preformatted text is of course not the only way to format code, it is just the easiest. Using a different method (eg. a div for each line with non-collapsing yet still breaking spaces of some description) would allow wrapping to occur, athough I still have not invented a nice way to automatically have continuation symbols show up.

    I remain certain I'll find a clean CSS way eventually.

  3. zorg says:

    pre { margin-right : 10em ; }

  4. notzorg says:

    pre { width:24em; overflow:auto; }

  5. Arne Babenhauserheide says:

    You could make this look good by simply leaving out most of the prompt: ecmascript@(guile-user)> → >

Comments are closed.