scheme

What's the proper scheme file extension?


Files of the programming language Scheme are by convention either of the extension .scm or .ss.

I'm interested in what the history of these extensions is, and also in the proper use, though it seems the universal attitude is that it's just whatever you prefer and it doesn't matter, but maybe I'm wrong about that.


Solution

  • There is no proper Scheme extension. I've browsed through R[567]RS and it is not specified.

    This is deliberate as the Appendix F in a R6RS Non-Normative Appendices draft (PDF) actually had a part about mapping from library path to file paths which didn't make the final spec.

    With that said, the most common file extension for Scheme programs is .scm and there have been other extensions added in R6RS and perhaps R7RS by implementers to distinguish library from main programs.

    In fact the only thing that the implementations need to assure is that there is a way to "install" a library and that is usually a file that needs to map to the library name in the source code. In Racket's R6RS this is done by an installation program:

    plt-r6rs --install test.xxx 
    [installing /home/westerp/.racket/6.4/collects/examples/hello.ss]
    [Compiling /home/westerp/.racket/6.4/collects/examples/hello.ss]
    

    So in fact for racket it accepts any file name/extension without question, but it uses .ss as extension for R6RS and it looks for .sls and .scm files as well should you manually do what the plt-r6rs --install does by hand.

    Other implementations might require a manual ways to install a library but it is still nothing to do with the Scheme language since the specification left this part out to be solved by the implementations.