Computing Reviews

Optimizing SYB is easy!
Adams M., Farmer A., Magalhães J.  PEPM 2014 (Proceedings of the ACM SIGPLAN 2014 Workshop on Partial Evaluation and Program Manipulation, San Diego, CA, Jan 20-21, 2014)71-82,2014.Type:Proceedings
Date Reviewed: 05/27/14

One of the mainstays of advanced programming is the technique called datatype generic programming, where one writes a single traversal routine that works over many different data types. While this has been used in C++ for a long time, the real breakthrough came when Lämmel and Peyton Jones [1] introduced scrap your boilerplate (SYB) in Haskell. What was previously an untyped operational technique became a properly understood, statically typed technique. But there remained a problem: efficiency.

At least in theory, the call site of functions written in this style contains all of the information needed to instantiate the generic machinery into efficient code. The paper at hand shows how this theory can be made practical, which is a major engineering feat. The paper is very clear (at least for seasoned Haskellers), going through the required ideas in a pedagogically sound manner before giving all of the required formal details. As with most authors, the virtues of their method are explained, but unlike most, they explicitly talk about a few shortcomings.

For me, there are two outstanding questions: Why SYB and not one of the subsequent variants? Why no references to type-directed partial evaluation (TDPE) [2]? TDPE would seem to immediately solve the problem of selective traversal at other types.

This paper deserves its catchy title, filling in an important missing step in the SYB story. It is both well written and formally precise, and it solves an interesting problem. It is well worth reading.


1)

Lämmel, R.; Peyton Jones, S. Scrap your boilerplate: a practical design pattern for generic programming. In Proceedings of the 2003 ACM SIGPLAN International Conference on Types in Languages Design and Implementation ACM, 2003, 26–37.


2)

Danvy, O. Type-directed partial evaluation. In Proceedings of the 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages ACM, 1996, 242–257.

Reviewer:  Jacques Carette Review #: CR142316 (1408-0665)

Reproduction in whole or in part without permission is prohibited.   Copyright 2024 ComputingReviews.com™
Terms of Use
| Privacy Policy