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

 
 

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

Submitted by:  Dean Ferreyra <dferreyra>
Submitted on:  Fri 28 Jul 2006 10:03:31 PM UTC  
 
Category: Scheme languageSeverity: 3 - Normal
Item Group: Unexpected resultStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project 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 File(s):
   
   
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

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follows 1 latest change.

Date Changed By Updated Field Previous Value => Replaced By
Fri 28 Jul 2006 10:03:31 PM UTCdferreyraAttached File-=>Added capture.scm, #10435

Back to the top


Powered by Savane 3.1-cleanup