Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
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: May 27 2014

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.

Reviewer:  Jacques Carette Review #: CR142316 (1408-0665)
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.
Bookmark and Share
  Featured Reviewer  
 
Partial Evaluation (F.3.2 ... )
 
 
Haskell (D.3.2 ... )
 
Would you recommend this review?
yes
no
Other reviews under "Partial Evaluation": Date
The abstraction and instantiation of string-matching programs
Amtoft T., Consel C., Danvy O., Malmkjær K. In The essence of computation. New York, NY: Springer-Verlag New York, Inc., 2002. Type: Book Chapter
Sep 22 2003
Constraint-based partial evaluation for imperative languages
Ying J., Chengzhi J. Journal of Computer Science and Technology 17(1): 64-72, 2002. Type: Article
Apr 25 2003
Toward a complete transformational toolkit for compilers
Bergstra J., Dinesh T., Field J., Heering J. ACM Transactions on Programming Languages and Systems 19(5): 639-684, 1997. Type: Article
May 1 1998
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy