bugKawa - Bugs: bug #13601, define-syntax and private...

 
 

bug #13601: define-syntax and private namespaces problem

Submitted by:  Dean Ferreyra <dferreyra>
Submitted on:  Fri 01 Jul 2005 06:16:52 PM UTC  
 
Category: Type declaration and inferenceSeverity: 3 - Normal
Item Group: Unexpected resultStatus: Fixed
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Wed 06 Jul 2005 04:05:49 AM UTC, comment #1:

I've checked in a semi-fix.

The issue is that namespace-resolution is done at the same time as macro expansion (and name resolution in general), not at read time. Thus namespace definitions need to be made available to the importing module.

This approach has some problems. One is that we don't have object identity between quoted literal as returned by read and the quoted value at run-time. This becomes a bigger issue if/when we are to support SRFI 38 (handling cycles and shared structure). Also, we'd like to change it so we implement Scheme symbols using Symbols rather than Strings. So we might want to consider do namespace-resolution at read-type - like Common Lisp does.

So I implemenmted a quick kludge to include namespace definitions are private symbols. The kludge part is that we always create a field, even if the namespace isn't used in a a macro. We should reconsider/re-do this if/when we make the changes mentioned in the previous paragraph.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Fri 01 Jul 2005 06:16:52 PM UTC, original submission:

We're seeing a problem with define-syntax and private namespaces.

I've attached an example. In it I define a macro, try-me-too, that uses namespace ST. If I add a module-export declaration that does not include the namespace (thus making the namespace private), the compiler gives a warning during the expansion of try-me-too, and at runtime I get the UnboundLocationException error. When I explicitly export the namespace, this works.

I'm assuming here that I shouldn't have to export the namespace to get this to work, similar to how things work now with unexported functions (the try-me macro in the expansion).

This is with a recent pull from CVS. Here's what I'm seeing:

% make PURE=1 default
rm -f *.class
CLASSPATH=.:~/kawa/cvs/kawa-pure-build/kawa-1.7.91.jar java kawa.repl --warn-undefined-variable --module-static-run -C macro.scm
(compiling macro.scm)
CLASSPATH=.:~/kawa/cvs/kawa-pure-build/kawa-1.7.91.jar java kawa.repl --warn-undefined-variable --module-static-run --main -C use.scm
(compiling use.scm)
macro.scm:17:6: warning - no declaration seen for ST:new
CLASSPATH=.:~/kawa/cvs/kawa-pure-build/kawa-1.7.91.jar java use
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: gnu.mapping.UnboundLocationException: unbound location ST:new
at gnu.mapping.Location.get(Location.java:67)
at use.test(use.scm:7)
at use.run(use.scm:5)
at gnu.expr.ModuleBody.run(ModuleBody.java:44)
at gnu.expr.ModuleBody.run(ModuleBody.java:32)
at use.<clinit>(use.scm)
Got: 20
make: *** [run] Error 1

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 #3142:  private-namespace.diff added by dferreyra (619B - application/octet-stream - Example that demonstrates this)

 

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):

 

 

Follow 4 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Wed 06 Jul 2005 04:05:49 AM UTCbothnerStatusNone=>Fixed
  Assigned toNone=>bothner
  Open/ClosedOpen=>Closed
Fri 01 Jul 2005 06:16:52 PM UTCdferreyraAttached File-=>Added private-namespace.diff, #2650

Back to the top


Powered by Savane 3.1-cleanup1