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

eval questions

The draft report says that (scheme-report-environment version) "returns
a specifier for an environment that contains exactly the set of bindings
specified in the corresponding report."

I have a few questions about this:

1. May/must the environment contain bindings for variables that name
optional procedures, such as transcript-on and sin?  If not, what exactly
is the set of bindings specified in the corresponding report?  My guess
is that the intent is for the environment to contain all required bindings
and some subset of the optional bindings, but the word "exact" here
is inappropriate.

2a. Can the environment contain bindings for identifiers not present in
the report?  The word "exact" notwithstanding, I believe that the answer
to this question is yes.  Say the environment contains a binding for the
variable foo to a location containing the value 3.  Since it is an error
to reference an unbound variable, but an implementation is not required
to signal the error, we can simply claim that foo is not bound.  So what
if erroneous references to foo happen to return 3?  So what if erroneous
references to foo return 4 after an erroneous assignment of foo to 4?

2b. If the answer to Question 2a is indeed yes, what does the restriction
that eval is not allowed to create new bindings in the environment
associated with scheme-report-environment mean?

2c. Again, if the answer to Question 2a is yes, can I not simply define
scheme-report-environment as follows:

   (define scheme-report-environment
     (lambda (v)
       (if (eq? v 5)
           (error ...))))

assuming that the environment specified by the value returned by
interaction-environment contains a superset of the bindings listed
in R5RS?

3. Suppose an implementation conforms to R5RS but supports version=3.
Must (eval '(eqv? "" "") 3) return #t, as required in R3RS?  Must
(eval '(if '() 'yes 'no) 3) return no, as required in R3RS?  Looking
forward, if we alter the semantics of some required procedure for R6RS,
e.g., eval(!), must a conforming R6RS implementation support the R5RS
semantics if it allows version=5?

I have similar questions about null-environment.

I apologize for bringing these questions up at the last minute, but I
am just now getting around to trying to implement this feature.