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

 
 

bug #13601: define-syntax and private namespaces problem

Submitter:  Dean Ferreyra <dferreyra>
Submitted:  Fri 01 Jul 2005 06:16:52 PM UTC
   
 
Category:  Type declaration and inference Severity:  3 - Normal
Item Group:  Unexpected result Status:  Fixed
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group administrator
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 Files:
   
   
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

 

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.

 

Follow 4 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-07-06 bothner StatusNone Fixed
    Assigned toNone bothner
    Open/ClosedOpen Closed
2005-07-01 dferreyra Attached File- Added private-namespace.diff, #2650

Back to the top

Powered by Savane 3.13-4b48.
Corresponding source code