http://www.spinellis.gr/pubs/Breview/2009-CR-TangoD/html/review.html
This is an HTML rendering of a working paper draft that led to a publication. The publication should always be cited in preference to this draft using the following reference:

The document's metadata is available in BibTeX format.

Find the publication on Google Scholar

This material is presented to ensure timely dissemination of scholarly and technical work. Copyright and all rights therein are retained by authors or by other copyright holders. All persons copying this information are expected to adhere to the terms and constraints invoked by each author's copyright. In most cases, these works may not be reposted without the explicit permission of the copyright holder.

Diomidis Spinellis Publications


Copyright © 2008 by the Association for Computing Machinery, Inc. Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, to republish, to post on servers, or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from Publications Dept, ACM Inc., fax +1 (212) 869-0481, or permissions@acm.org.

Book Review: Learn to Tango with D

Diomidis Spinellis
Athens University of Economics and Business

Bell K., Igesund L., Kelly S., Parker M.
Learn to Tango with D
Apress, 2007
208 pp.

D is a strongly typed, natively compiled language, and Tango is one of its major companion libraries. The major intellectual forebear of D is clearly C++ (the language’s designer, Walter Bright, developed the first native C++ compiler, Zortech C++). However, D sheds many nowadays often irritating legacy C++ features. Gone is the preprocessor and the C data types that retain compatibility with programs written for the PDP-11 more than 30 years ago. D defines from scratch an intuitive set of basic data types derived for modern hardware architectures, and puts in order C’s postfix declarations, and the passing of variables to functions by defining in, out, and reference argument types. D also balances nicely Java’s compulsory overhead of subtyping polymorphism against the unattractiveness of the C++ virtual method declarations by using the “struct” keyword for defining objects that can’t be subclassed and reserving the “class” keyword for building class hierarchies with dynamic dispatch tables. Furthermore, D adopts innovations from other languages, like Java, C#, and Eiffel, by supporting modules, delegates, and invariants.

At times one is however left with the feeling of creeping featurism run wild. There is built-in support for associative arrays and unit tests, complex numbers, template metaprogramming, and the innovative concept of compile-time function evaluation. To this reviewer the selection of features to include in the language seems arbitrary. If one adds these features to a programming language, why stop there and not add support for XML constants, SQL statements, internationalization, matrices, or branch prediction annotations? There is also an unclear boundary between abstract concepts and implementation-related properties, like the distinction between (kernel implemented) threads and (language-supported) fibers. In general, D seems like a language that solves yesterday’s problems admirably well, but fails to address modern challenges, like increased memory latencies and multi-processor and distributed programming on the systems programming side, or web, end-user, and domain-specific programming on the application side.

“Learn to Tango with D” is clearly not a beginner’s guide but does a nice job in introducing the language and its library to programmers versed in C++, Java, and C#. Programmers who aren’t familiar with all these languages may find some of the descriptions slightly cryptic, as they assume knowledge of how these features function in another language. The writing is in general clear, though a chapter on the dry subject of procedural lifetime mysteriously appearing in the middle of the book in which the notion of delegates crops up without any prior introduction certainly seems out of place. Furthermore, the explanation of how the novel, interesting, and apparently useful “scope” statement works could be improved: currently the reader is left mystified on whether the statement’s scope is static or dynamic. In addition, the examples used throughout the book, although adequate for the purpose they serve, could be enhanced by being more useful and imaginative. Finally, the book lacks an index, an inexcusable omission in the age of electronic typesetting.

There is still space for a language better than D and for a book on D better than this one. In the meantime, both the language and the book are remarkable offerings.