Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Scheme Programming Language

How does dynamic-wind work?


As I learn Scheme, I am sort of mentally figuring out what the minimum
set of primitives is. Initially, I thought that dynamic-wind must be a
primitive, but now I'm not so sure.

If call/cc were never invented, you could make dynamic-wind by saying
(define dynamic-wind
        (lambda (a b c)
                (begin a b c)))
Since the only way into b is by calling it, this ensures that a and c
are called before and after it. The problem, as so often, is that
call/cc means we can jump into b from anywhere.

So what if you masked call/cc somehow? If b calls call/cc then it
really calls our fake call/cc, which returns a continuation that calls
a first and c after.

I'm not entirely sure how to fake it. fluid-let would only work if they
haven't made another name point at call/cc, which means it's probably
impossible.

Am I on the right track? Do I completely misunderstand some feature of
dynamic-wind?

--Ross

That's the essence of it: CALL/CC needs to cooperate with DYNAMIC-WIND
so as not to destroy its invariants.  As to how it works, you might find

http://mumble.net/~jar/pubs/scheme-of-things/june-92-meeting.ps

or

http://www-pu.informatik.uni-tuebingen.de/users/sperber/papers/adding...

helpful in understanding the technicalities.

--
Cheers =8-} Mike
Friede, Vlkerverstndigung und berhaupt blabla

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc