[r6rs-discuss] [Formal] Position-significance of declarations in scripts

From: AndrevanTonder <andre>
Date: Mon Oct 2 03:58:49 2006

Name : Andre van Tonder
Email : andre at het.brown.edu
Type : defect
Priority : minor
Component : Script semantics
Version : 5.91
Pages : 27
Dependencies: None

Summary:
--------

Position of declarations in scripts is significant,
since interspersed declarations cannot be consistently
applied to expand-time computations. This is
confusing.

Description:
------------

The draft states:

"All declarations at the script top level are moved to the front."

which gives the impression that such declarations will have
the whole body as their region.

However, the position of a declaration is significant, as
in the script:

....
(+ 5 6)
(define-syntax foo (let ((expand-time-calc (+ 1 2)))
                       (lambda (stx) (+ 3 4))))
(declare fast)
....

Here the declaration (+ 1 2) must be evaluated before
the declaration is expanded according to the rules on
p. 27 (since the definition of foo could determine
whether (declare fast) is really a declaration).

Since FAST cannot apply to (+ 1 2), the position of the
declaration is significant. The fact that FAST /does/
apply both to the preceding (+ 5 6) and the following
(+ 3 4) is confusing.

Suggestion:
-----------

Perhaps require declarations to be at the front as in bodies.
Received on Sun Oct 01 2006 - 13:00:45 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:00 UTC