Reflection is the ability for programs to examine themselves.  In Step, this takes the form of predicates that answer questions like:

  • Is my argument a task?
  • What are the tasks in the program?
  • What are the methods of this task?
  • Have I called this task so far?

In programming languages, we often distinguish between static properties of the program, which are properties of the text of the program rather than any particular run of it, and dynamic properties, which involve the behavior of the program as it runs.

This is mirrored naturally in reflection capabilities.  Static reflection tells you things about the text of the program: what tasks and methods does it have, what calls what, etc.  Dynamic reflection tells you things about the program as it's running: what's running now?  What was run previously?

We'll talk about each of these now, in turn.

Previous: Parsing
Next: Static reflection