includeschemeloadmit-schemer6rs

include vs. load in mit-scheme


What is the difference between (include path) and (load path) in mit-scheme?

I grep the source code of mit-scheme and I see a few uses of include and I found the definition of load in the reference documentation, but I cannot find the semantics.

I also found the include-ci -- I have never used it. How is it different of the others ?

Personally, I used (include FILE) lots of times, but thinking of it as having the same semantics as #include of the language of the preprocessor and it worked so.

For me it is not clear the level at which these are interpreted. Is include executed at the level of reader/syntax desugaring/runtime ?

Can someone clarify me the meaning of these, please ?


Solution

  • I will answer alone this question because in the meantime I found the answer.

    The feature was introduced in mit-scheme at this point:

    commit 70bf1e80dc3a70e2017bacd490516add36c5a8d6
    Author: Chris Hanson <org/chris-hanson/cph>
    Date:   Sat May 19 22:30:49 2018 -0700
    
        Implement include and include-ci for R7RS.
    

    The things go in this order: the reader reads the file, it returns a s-expression that contain the content of the file (including subexpressions like (include ....)). The s-expression returned by reader is inserted in macro-expander and at this level the (include ...) directives are expanded (in this case, it is called the reader with the name of the file, by the syntax procedure of expansion). The macro-expander will return a scode data structure (a language of combinators that express the s-expression in desugared form). The (include FILE) is no more present at the stage of scode combinators. Instead, the (load ...) are present and will be executed after the scode enters in evaluator.

    This answers my question. The provided link, in the comments, did only partially answer, what I was interested about.