Cook Computing

Functional Objects Dylan

February 11, 2003 Written by Charles Cook

Ted Leung's blog entry about the programming langauge Dylan (via Chris Double) prompted me to look at the Functional Objects site. Dylan has only been vaguely lodged in my mind as an "infix version of Lisp" and a language/development environment that was canned by Apple a few years ago, so it was interesting to read a bit more about it. The article Beyond Java?, which compares Dylan with Java, is worth reading because the comparisons also work with C#. Dylan has features such as MI, multi-dispatch, no casting, and macros which are all missing from both Java and C# (the macros being real macros in the Lisp sense and not C-style macros).

I get the impression that Dylan is a considerably richer language than Java or C# yet is claimed to be just as efficient as those languages. From my experiences with Lisp and Scheme I think the prefix style with lots of brackets is always going to put off a majority of developers so maybe something like Dylan with its more conventional-looking syntax could have been a success. Paul Potts certainly thinks so in his Apple Dylan Eulogy:

Dylan was, in part, an attempt to build a bridge between static language users and the dynamic language community. The Cambridge team wisely understood that C programmers would be generally unwilling to convert to a parenthesized, prefix syntax: for this reason, Dylan was given a Pascal-like syntax. Programmers who have used Lisp generally come to feel comfortable with it; I've used Scheme enough now to feel be somewhat accustomed to the style, but I will probably always prefer a non-Lispy syntax. Computer science types can say "that's just syntax; it is irrelevant," but in fact many barriers to language adoption are cultural and practical, not technical.

It seems to be possible, to this day, to graduate from a computer science program having learned either the idioms and scenery of the Lisp/Scheme world, or the rules and scenery or the C/C++/Java/C# world, but not both. We just generally aren't willing to venture into each other's alien landscape. The static language community continues to make marginal improvements to its languages, not realizing the improvements they are discovering are they are discovering are twenty or more years old. But that is the subject for some ranting another day.

This is certainly true if you have not studied Computer Science, in which case you have probably only learnt languages such as C++, Java, or even only VB, and may have developed a fairly blinkered view of programming languages in general. I know this applies to me and which is why Im finding languages such as Lisp and Scheme so fascinating. To take a simple example, if youve only worked with C++ or Java you may not be aware that the single dispatch mechanism of these languages is a subset of the multiple-dispatch mechanism that some other languages have.

Its difficult to say for sure whether being familiar with a wider range of languages actually helps you design and implement better Java or C# programs. My feeling is that being more aware of the limitations of these languages does help: seeing things from a broader perspective improves understanding and in the same way that Patterns enhance the way you think about design problems, knowledge of a wider range of languages gives you more concepts to work with, even if you cannot directly use some of the techniques with the language you are working with.