[plt-scheme] Bug in Syntax Certification?
At Sun, 15 Jun 2008 11:39:55 -0400, Will Farr wrote:
> Hello,
>
> I'm seeing a weird error message when I try to use iteration macros
> outside the module I defined them in. For example, the following
> breaks (in the scheme language in DrScheme, version 4.0.0.1-
> svn13jun2008):
>
> (require (planet wmfarr/simple-matrix:1/matrix))
> (for/list ((x (in-matrix (matrix* 2 2 1 2 3 4)))) x)
>
> with the error
>
> compile: access from an uncertified context to unexported variable
> from module: "/Users/farr/Documents/code/simple-matrix/matrix.ss" in:
> matrix-elts
>
> There are two weird things about this error:
>
> 1. matrix-elts is exported from the matrix.ss module.
Is it maybe exported with a contract, so that the `matrix-elts' binding
within the module is different than the exported one?
> 2. I haven't been playing with certifying identifiers at all (in fact,
> I have only a vague notion of what certifying an identifier means).
Right, you shouldn't have to do anything with them...
> Is this because I've used define-sequence-syntax to define in-matrix
> inappropriately (the code for in-matrix and its companion procedure
> *in-matrix is given below)? Is this a problem with the syntax
> expander in Friday's SVN?
It's a bug within `for' (and company) in the expansion of sequences.
Since `for' implements its own little expander, it needs to certify
things in the same way as the normal macro expander. Although it was
correctly adding certificates, it wasn't propagating certificates from
a previous expansion (in this case, `in-matrix' to `in-vector') to the
result of another expansion (in this case, `in-vector').
This is fixed in SVN.
Matthew