Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#816 closed defect (fixed)

hygiene problem using `map' with prefixed `scheme' import

Reported by: Moritz Heidkamp Owned by:
Priority: minor Milestone: 4.9.0
Component: compiler Version: 4.7.x
Keywords: Cc:
Estimated difficulty:

Description

The compiler seems to rewrite calls to map in an unhygienic fashion. This surfaces when importing the scheme module with a prefix into a fresh module. The interpreter handles it fine though.

Example:

(module foo

()

;; the `quote' import is necessary due to another hygiene problem 
;; I'm investigating right now
(import (only scheme quote))
(import (prefix scheme ~))

(~map (~lambda (y) y) x)

)

This leads to the following warnings by csc (tested with 4.7.0.3-st and current master):

Warning: reference to possibly unbound identifier `set!'
Warning:    suggesting one of:
Warning:    (import r5rs-null)
Warning:    (import r4rs-null)
Warning:    (import scheme)
Warning:    (import r4rs)

Warning: reference to possibly unbound identifier `cons'
Warning:    suggesting one of:
Warning:    (import scheme)
Warning:    (import r4rs)

Warning: reference to possibly unbound identifier `g14'

Warning: reference to possibly unbound identifier `and'
Warning:    suggesting one of:
Warning:    (import r5rs-null)
Warning:    (import r4rs-null)
Warning:    (import scheme)
Warning:    (import r4rs)

Warning: reference to possibly unbound identifier `if'
Warning:    suggesting one of:
Warning:    (import r5rs-null)
Warning:    (import r4rs-null)
Warning:    (import scheme)
Warning:    (import r4rs)

Warning: reference to possibly unbound identifier `map-loop'

Warning: reference to possibly unbound identifier `x'

Warning: reference to possibly unbound identifier `g25'

Warning: reference to possibly unbound identifier `g19'

Warning: reference to possibly unbound identifier `g18'

Warning: reference to possibly unbound identifier `g17'

Warning: reference to possibly unbound identifier `let'
Warning:    suggesting one of:
Warning:    (import r5rs-null)
Warning:    (import r4rs-null)
Warning:    (import scheme)
Warning:    (import r4rs)

Error: module unresolved: foo

Attachments (1)

0001-Always-add-default-core-macros-to-syntax-env-in-inte.patch (3.6 KB) - added by sjamaan 9 years ago.
Always add core macros to syntax env of internal compiler syntax

Download all attachments as: .zip

Change History (5)

comment:1 Changed 9 years ago by Moritz Heidkamp

The culprit here is the macro defined in compiler-syntax.scm, line 91. The problem can be avoided for now by passing -no-compiler-syntax to the csc call.

comment:2 Changed 9 years ago by sjamaan

Here's a simple fix. Maybe this can make it into 4.8.0?

Changed 9 years ago by sjamaan

Always add core macros to syntax env of internal compiler syntax

comment:3 Changed 9 years ago by felix winkelmann

Resolution: fixed
Status: newclosed

comment:4 Changed 9 years ago by felix winkelmann

Milestone: 4.8.04.9.0

Milestone 4.8.0 deleted

Note: See TracTickets for help on using tickets.