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

[Scheme-reports] 5.1 programs

The docs say:

  Program parts other than expressions that are present at the top
  levele of a program can be interpreted declaratiely.  They cause
  bindings to be created in the top level environment or modify the
  value of existing top-level bindings.  Expressions occurring at the
  top level of a program are interpreted imperatively; they are executed
  in order when the program is invoked or loaded and typically perform
  some kind of initialization.

I don't think that "declaratively" is right here.  A definition can
cause a side effect, viz:

  (define foo (begin (delete-file "bar") 1))

Furthermore order and scope is unclear.  Using R6RS expansion rules --
and, whether you agree with them or not, they are a model for clarity --
you can indeed interpret some parts declaratively; the even? / odd?
example that is frequently trotted out for nested definitions works for
toplevel definitions as well.

Funally the result of invoking a continuation captured at the toplevel
is not mentioned.  On purpose?


Scheme-reports mailing list