SCOOL: Generic programming

From LRDE

(Redirected from Publications/200901-Seminar-VanNoppen)

Abstract

Cxx has proved to be a powerful language to write generic and efficient libraries. However using classical oo Cxx may not fulfill the efficiency criterion sought in some domains, e.g. when building scientific librarieswhere large data sets have to be processed through generic algorithms. A solution consists in combining the power of oop and emphstatic programming— which is in fact meta-code expressed thanks to Cxx template constructs. This has the advantage to replace the oo run-time overhead (due to virtual method dispatch) by compile-time computations. However, such an approach relies on code that is verbose, hard to write and to maintain. Though powerfulCxx lacks high-level static features, and thus clutters the semantics of static constructs with unrelated code. We present Scool, a static language mixing acoo and gp that has been created to take advantage of all the power of static Cxx thanks to a more expressive syntax and high-level constructs, without the drawbacks of plain Cxx. As a full-fledged static OOP language, Scool provides polymorphic methods (i.e., inclusion polymorphism), with the notable difference that every polymorphic call is statically-resolved: the design of Scool is based on the property that the exact (dynamic) type of every object is known at compile-time. As the aim of Scool is to bring all the power of static oop to Cxx, it is not directly compiled but translated into human-readable Cxx. The development of the translator raised classical problems found in dsl like traversal strategies of the abstract syntax tree. We propose an original solution based on the Stratego/XT program transformation framework, and some applications on Milena, a generic and efficient Cxx library from the Olena image processing platform.