Dylan Programming

Frequently Asked Questions (FAQ)

    General

    (see also the cetus-links)
  1. What is Dylan?
    Go to www.gwydiondylan.org for a good summary of the language. Basically, Dylan is a Functional Object-Oriented Language that has (among other things) dispatch to methods based on multiple arguments, higher order functions, multiple inheritance, hygenic macro system, and a clearer and cleaner separation of types and classes.

  2. Does Dylan work on my platform, and where can I get it?
    Yes. A fully developed and supported version is available for Windows from Functional Objects. Other platforms may look at the Gwydion Dylan web site for binaries (so far Mac, Be, Linux on intels, Sun Sparcs, HP-UX and Cygnus (linux on Windows)).

  3. What books about Dylan are available?
    Several; the best two are Dylan Programming (a very good tutorial book) by Feinberg, Keene, Mathews, and Withington, and the Dylan Reference Manual by Shalit, Moon, and Starbuck. Both are available from Functional Objects.

  4. Are there any on-line tutorials?
    Yes, the two that come to mind are: Getting started with Dylan by Eric Kidd, and an incomplete but interesting tutoral by Paul Haahr. A First Look at Dylan by Steve Strassmann gives a good overview of the language with some example code; which leads to the next question:

  5. Where can I look at some example code?
    Chris Double now has several pages devoted to Dylan, one of them has some example code of CORBA, OpenGL, and bitmaps. There's also a full-blown example for QuickTime from Apple. Almost all of Gwydion Dylan is written in Dylan, so one may examine the source code of their tools for a great deal of Dylan code examples.

    How Does Dylan Differ from other OOPLs?

  6. Languages such as C++, Smalltalk, and Java are single-dispatch languages and have well-known deficiencies handling what are known as "binary" methods. Binary methods implement operations such as "+" or "<" where neither argument is obviously the "receiver" and where the choice of implementation really depends on both arguments.

    Dylan, as well as CLOS, Cecil, and others, uses "multiple dispatch", which is a generalization of the single dispatch mechanism of C++, Java, and Smalltalk. Whereas in single dispatch there is a distinguished "receiver" object whose class determines the method chosen, multiple dispatch uses the classes of all the arguments of a call to choose the most applicable method.

    (contributed by Greg Sullivan, gregs@ai.mit.edu)

    How do I ...

  7. How do I make a vector of constants?
    Making a vector of literals is easy:
    
        let first-five = #[1, 2, 3, 4, 5];
    
    
    There's a gotcha, though, as has been discussed on comp.lang.dylan, given:
    
        define constant $jack = 11;
    
        define constant $queen = 12;
    
        define constant $king = 13;
    
        define constant $ace = 14;
    
    
    one cannot do this:
    
        let faces = #[$jack, $queen, $king, $ace]; // doesn't compile
    
    
    However, one can use the vector function to achieve pretty much the same thing:
    
        let faces = vector($jack, $queen, $king, $ace); // ok
    
    
    (Jason Trenouth explains this gotcha in detail).

  8. How do I pass command-line arguments to a Dylan executable?
    The function application-arguments() gives an array of strings passed in from the command-line (see a detailed discussion here).

  9. Hey! I format-out() something, and it doesn't show in the shell ... why?
    That's a gotcha ... use force-output(*standard-output*); after you output something.

    Tools

  10. Are there any parser generators for dylan?
    The Gwydion Dylan system comes with a couple: lisp2dylan and parsergen (which has it's own lisp to dylan translator). You may want to consider using the Meta library for Dylan, which provides a set of macros that allow you to create efficient and specific parser-generators.

Please email me at dauclair@hotmail.com with questions you'd like answered on this FAQ.


(back to main page) 1