User loginNavigation |
Generic implementation of all four *F* operators: from control0 to shiftUnlike the previous approaches, the latest implementation is generic. Shift and control share all the same code, and differ in only one boolean flag. Therefore, it becomes possible to mix different control operators in the same program. Furthermore, the latest implementation is direct rather than emulation (in terms of an object-level shift), therefore, it has the best performance. The code is surprisingly simple, compared with the previous implementation of 'control' by Sitaram and Felleisen, and does not require equality on continuations. All four delimited control operations do indeed reduce to call/cc and one global mutable cell, and hence have a quite simple CPS transform. That has been known since the paper by Chung-chieh Shan (Scheme Workshop, 2004). The current code shows that result more directly. Oleg's implementation provides all four Friedman-Felleisen delimited control operators: from -F- (similar to cupto) to +F- (aka control) to +F+ (aka shift). The R5RS Scheme code is parameterized by two boolean flags: is-shift and keep-delimiter-upon-effect. All four combinations of the two flags correspond to four delimited control operators. |
Browse archivesActive forum topics
|
Recent comments
4 days 4 hours ago
1 week 3 days ago
1 week 3 days ago
2 weeks 23 hours ago
2 weeks 4 days ago
2 weeks 4 days ago
2 weeks 6 days ago
2 weeks 6 days ago
2 weeks 6 days ago
3 weeks 1 day ago