bugKawa - Bugs: bug #17229, Hygienic macros permit capture of...

 
 

bug #17229: Hygienic macros permit capture of top-level bindings

Submitter:  Dean Ferreyra <dferreyra>
Submitted:  Fri 28 Jul 2006 10:03:31 PM UTC
   
 
Category:  Scheme language Severity:  3 - Normal
Item Group:  Unexpected result Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 30 Jul 2006 03:34:27 PM UTC, comment #1: 

"since the-cache and the-cache-has-been-set? are free identifiers in the scope of the define-syntax form (i.e., the module that the file defines does not bind them anywhere), then they should be each be rewritten as some unique symbol at expansion-time."

It's more complicated than that. If these were just references, without the define forms, wouldn't you expect the-cache to resolve to the same variable in the dynamic scope?  (Of course you'd also get a warning if using --warn-undefined-variable.)

Per Bothner <bothner>
Group administrator
Fri 28 Jul 2006 10:03:31 PM UTC, original submission:  

The attached sample generates the following errors on compile:

% java -jar kawa-1.8.1alpha.jar -C ~/capture.scm
(compiling /home/dferreyra/capture.scm)
/home/dferreyra/capture.scm:14:16: warning - duplicate definition of '*the-cache*' here
/home/dferreyra/capture.scm:14:16: warning - previous definition of '*the-cache*' here
/home/dferreyra/capture.scm:15:16: warning - duplicate definition of '*the-cache-has-been-set?*' here
/home/dferreyra/capture.scm:15:16: warning - previous definition of '*the-cache-has-been-set?*' here
(compiling /home/dferreyra/capture.scm to capture)

Expected behavior: since the-cache and the-cache-has-been-set? are free identifiers in the scope of the define-syntax form (i.e., the module that the file defines does not bind them anywhere), then they should be each be rewritten as some unique symbol at expansion-time.

In the repl it seems to work fine:

  #|kawa:26|# (foo)
  foo!
  foo
  #|kawa:27|# (bar)
  bar!
  bar
  #|kawa:28|# (foo)
  foo
  #|kawa:29|# (bar)
  bar

and it works under Scheme 48 1.3 and DrScheme version 350.

This is on a recent svn pull, revision 5372.

This was discovered by Luis.

Dean Ferreyra <dferreyra>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #10435:  capture.scm added by dferreyra (742B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follows 1 latest change.

Date Changed by Updated Field Previous Value => Replaced by
2006-07-28 dferreyra Attached File- Added capture.scm, #10435

Back to the top

Powered by Savane 3.13-f8d8.
Corresponding source code