[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] General comments on the draft WG1 R7 report.



On Sat, 28 May 2011 02:41:00 -0400, Jay Reynolds Freeman  
<jay_reynolds_freeman@x> wrote:

> In the latter kind of implementation, many of the compile-time/
> run-time distinctions that John mentions do not exist, in the sense
> that *everything* happens within a run-time environment.

I'm just going to jump in here really quickly and respond to one issue.  
One of the rather "lazy" terminologies used by many Schemers, including  
myself, is the term, "compile-time." Actually, there are two core concepts  
that apply to both pure interpreters and to compilers, run-time and  
expand-time. A proper Scheme interpreter should have a distinction of the  
two, even if it the actual process of expansion is welded into the  
run-time.

In full procedural macro systems, there are infinitely many "phases" that  
exist, the two most common being the run and expand time. However, during  
expansion (expand-time), an implementation with procedural macros may  
evaluate arbitrary code, making it a sort of run-time as well, and there  
may be a level of expansion within the expand-time. This creates a tower  
of expansion phases. There are a number of writings on this, including  
Aziz's dissertation and ICFP paper [1], which has some important relevant  
sections.

Many Schemes, such as Chez Scheme, do in fact implement modules and  
libraries as syntax. This has a number of advantages. Doing so means that  
these forms "disappear" after expansion, which simplifies the core  
interpreter, and before the code is run. See Chez Scheme's module form [2]  
for an interesting discussion of this. See ChezWEB as a non-trivial  
application which makes heavy reliance on syntactic modules and libraries  
[4].

There is a portable syntax expander called psyntax [5] that a number of  
implementations use, and there are also a few other expanders that are  
considered easier to grok, but usually do not have the same level of  
"industrial" testing.

R5RS is, with some justification, somewhat quiet on the actual process of  
expansion, because there are many ways to do it. It is possible to  
interleave expansion and execution to some extent, but you should be  
careful in doing so. R6RS has a number of sections [3] that describe a  
more precise expansion process, and I recommend reading it to get a getter  
idea of these two distinct phases of evaluation.

	Aaron W. Hsu

[1] http://www.cs.indiana.edu/~dyb/pubs/implicit-phasing.pdf
[2] http://www.cs.indiana.edu/~dyb/pubs/popl99.pdf
[3] http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-13.html#node_chap_10
[4] http://www.sacrideo.us/v5/chezweb/index.xhtml
[5] https://www.cs.indiana.edu/chezscheme/syntax-case/

-- 
Programming is just another word for the lost art of thinking.

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports