# Origin of the term “phase”

**URL:** <https://racket.discourse.group/t/origin-of-the-term-phase/3287>\
**Category:** Questions & Answers\
**Tags:** question, macro\
**Created:** [November 1, 2024, 6:06pm UTC](https://racket.discourse.group/t/origin-of-the-term-phase/3287 "2024-11-01T18:06:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![LiberalArtist](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/liberalartist/32/151_2.png) [@LiberalArtist](https://racket.discourse.group/u/LiberalArtist)\
**Post date:** [November 1, 2024, 6:06pm UTC](https://racket.discourse.group/t/origin-of-the-term-phase/3287/1 "2024-11-01T18:06:13Z")

</div>

Did [“Composable and Compilable Macros: You Want it _When?”_](https://www-old.cs.utah.edu/plt/publications/macromod.pdf) coin the term “phase”?

The term is introduced in the first subsection of the introduction:

> The conventional solution is to decorate `"loadP.scm"` and similar files with `eval-when` annotations [7, 23] that designate the intended _phase_ of an expression:
> 
> ```
> (eval-when (compile) (load "E.scm"))
> (load "P.scm")
> 
> ```

(italics in the original)

Where `[7]` and `[23]` are:

> [7] R. K. Dybvig. _Chez Scheme User’s Guide_. Cadence Research Systems, 1998.  
> [23] G. L. Steele Jr. _Common Lisp: The Language_. Digital Press, second edition, 1990.

The [`eval-when` docs in the oldest archived CSUG](https://web.archive.org/web/20010411115613fw_/http://www.scheme.com/csug/system.html#g2256) and [the other page](https://web.archive.org/web/20010411040337fw_/http://www.scheme.com/csug/compat.html#g2387) referenced in its index entry don't have any use of the term “phase”. Nor does the entry in the [HTML version of _Common Lisp: The Language_](https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node68.html). Both call `eval`, `compile`, and `load` “situations”, as does the [current CSUG](https://cisco.github.io/ChezScheme/csug10.0/system.html#./system:s102).

Is the citation simply for `eval-when`, with the term “phase” new in this paper? Or is there some other origin?

---

<div class="post-metadata">

**Author:** ![samth](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samth/32/3_2.png) [@samth](https://racket.discourse.group/u/samth)\
**Post date:** [November 1, 2024, 8:00pm UTC](https://racket.discourse.group/t/origin-of-the-term-phase/3287/2 "2024-11-01T20:00:44Z")

</div>

I think it's from the concept of the "phase distinction" between types and terms, which was maybe introduced by Cardelli here: [http://lucacardelli.name/Papers/PhaseDistinctions.pdf](http://lucacardelli.name/Papers/PhaseDistinctions.pdf)

---

<div class="post-metadata">

**Author:** ![hendrikboom3](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/hendrikboom3/32/2748_2.png) [@hendrikboom3](https://racket.discourse.group/u/hendrikboom3)\
**Post date:** [November 2, 2024, 2:59pm UTC](https://racket.discourse.group/t/origin-of-the-term-phase/3287/3 "2024-11-02T14:59:02Z")

</div>

I might mention that in preLisp languages with macto processors,  
completely different notations were used for the macro-time and  
the run-time sublanguages. The macro language was used to generate  
a textual program, which was then fed into the compiler as a file  
in the nonmacro language.

The first conventional language to even try to break out of this  
mold was PL/1. which used a syntax somewnat resembling (but different  
from) its regular PROCEDURE syntax to express macros.

That was also the age that saw the appearance of language-independent  
macro processors like ML/1 and m4. They took advantage of the fact that  
programming languages were expressed as text files and could be  
processed as if they had very little structure beyond that.

Lisp was different in that the macro language was the same as the  
subject language. So a new term had to be invented.

-- hendrik

---

<div class="post-metadata">

**Author:** ![Gambiteer](https://avatars.discourse-cdn.com/v4/letter/g/779978/32.png) [@Gambiteer](https://racket.discourse.group/u/Gambiteer)\
**Post date:** [November 2, 2024, 6:34pm UTC](https://racket.discourse.group/t/origin-of-the-term-phase/3287/4 "2024-11-02T18:34:52Z")

</div>

I offer no opinion on the use of the word "phase", but this discussion reminds me of Section 9.11.3, entitled "Les niveaux d'evaluation" ("Evaluation Levels"), of Christian Queinnec's _Les Langages Lisp_ (1994), released in English as _Lisp in Small Pieces_ (1996), where he describes a "Tower of Evaluators". Each level has macros that are expanded using macros and functions from the level above, which defines macros and functions that can be used to expand the macros in the next level below. (Apologies to Christian if I didn't get the explanation completely correct.)

This is a textbook, so I doubt the book introduced the idea originally, but it made a big impression on me.

Brad

---

<div class="post-metadata">

**Author:** ![bakgatviooldoos](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bakgatviooldoos/32/1381_2.png) [@bakgatviooldoos](https://racket.discourse.group/u/bakgatviooldoos)\
**Post date:** [November 2, 2024, 8:15pm UTC](https://racket.discourse.group/t/origin-of-the-term-phase/3287/5 "2024-11-02T20:15:49Z")

</div>

I immediately thought of 3-LISP and Brian Smith when the question was asked, but he also speaks of "levels" in his hierarchy, the copy of which I have with me says February 1982.

 ![image](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/f/fdaaf83801fbd2ea397a39ed6948598ef20dadde.png)

It's a dense read, though. I have not gotten through it all, yet.

* * *

Edit:  
An interesting introduction to the material, and a link to the manuscript.  
[3-lisp-infinite-tower-of-meta-circular-interpreters](https://www.cofault.com/2022/08/3-lisp-infinite-tower-of-meta-circular.html)

---

<div class="post-metadata">

**Author:** ![EmEf](https://avatars.discourse-cdn.com/v4/letter/e/53a042/32.png) [@EmEf](https://racket.discourse.group/u/EmEf)\
**Post date:** [November 3, 2024, 6:39pm UTC](https://racket.discourse.group/t/origin-of-the-term-phase/3287/6 "2024-11-03T18:39:24Z")

</div>

Bruce Duba and I studied macro expansion while we were PhD students and decided that the co-mingling of values across macro expansion and compilation/interpretation processes was a mistake. We thought that an exploration of a system that separated those two pieces would be worthwhile. We started using the word “passes” because Scheme 84 was a compiler with several passes. We then used the temporal word “phase” because it distinguishes two different points of time in one compilation step. (We all experimented with 2Lisp 3Lisp Brown Blonde and such languages at the time, and we were thus aware of the word ‘“level”. — My own dissertation research suggested that the word “level” as used by Brian Smith seemed to be the result of a misinterpretation of language semantics, as in the “theory of” not a specific language or feature.)

Once I encountered the idea of a “phase separation theorem” in the world of type systems (ML), I truly began to prefer this word over others because what I had wanted was a “phase separation” of macro expansion and compilation/interpretation.

---

<div class="post-metadata">

**Author:** ![bakgatviooldoos](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bakgatviooldoos/32/1381_2.png) [@bakgatviooldoos](https://racket.discourse.group/u/bakgatviooldoos)\
**Post date:** [November 4, 2024, 7:22am UTC](https://racket.discourse.group/t/origin-of-the-term-phase/3287/7 "2024-11-04T07:22:18Z")

</div>

> [@EmEf](#):
>
> My own dissertation research suggested that the word “level” as used by Brian Smith seemed to be the result of a misinterpretation of language semantics, as in the “theory of” not a specific language or feature.

I apologize, but would you care to elaborate on this? I understand the words but not their meaning.
