2

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 ?

alinsoar
  • 15,386
  • 4
  • 57
  • 74
  • Which version of MIT Scheme are you using? I use MIT Scheme 9.1.1, and `(include "myprog.scm")` results in `;Unbound variable: include`. – Flux Feb 06 '20 at 07:59
  • @Flux 1 ]=> (identify-world) ... Image saved on Saturday August 10, 2019 at 6:28:48 PM Release 10.1.10 || Microcode 15.3 || Runtime 15.7 || SF 4.41 || LIAR/x86-64 4.118 – alinsoar Feb 06 '20 at 08:01
  • 1
    This might be something new. Try asking on the mit-scheme-devel mailing list. – Flux Feb 06 '20 at 08:02
  • @Flux I see in Changelog: commit 70bf1e80dc3a70e2017bacd490516add36c5a8d6 Author: Chris Hanson Date: Sat May 19 22:30:49 2018 -0700 Implement include and include-ci for R7RS. M src/runtime/mit-macros.scm M src/runtime/runtime.pkg – alinsoar Feb 06 '20 at 08:10
  • @Flux partially. I do not understand if `include` is executed during `read` or desugaring (macro expansion) -- is it in reader or in the 1st step of eval, before execution? I understand that `load` behaves like a procedure, at run-time, but I do not understand too much about `include` from these answers. – alinsoar Feb 06 '20 at 08:46

1 Answers1

1

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.

alinsoar
  • 15,386
  • 4
  • 57
  • 74