bugKawa - Bugs: bug #12317, Reader macros not working

 
 

bug #12317: Reader macros not working

Submitter:  Dean Ferreyra <dferreyra>
Submitted:  Mon 14 Mar 2005 07:50:09 PM UTC
   
 
Category:  Scheme language Severity:  3 - Normal
Item Group:  Unexpected result Status:  Invalid
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 17 Mar 2005 10:15:58 PM UTC, comment #4: 

Yes, that solves the problem in the test case and in our actual source tree.  Thanks Per.

Dean Ferreyra <dferreyra>
Thu 17 Mar 2005 10:01:09 PM UTC, comment #3: 

I checked in the patches to allow:
  java kawa.repl -e '(require <reader1>)' -C reader2.scm
Please let me know if that works for you.

Per Bothner <bothner>
Group administrator
Thu 17 Mar 2005 02:10:58 AM UTC, comment #2: 

For this to work the function set-dispatch-macro-character in reader1.scm must be called when compiling reader2.  This used to work for static modules when the module body was automatically run during class initialization; I doubt it ever worked for non-static modules.

I think correct behavior is that the compiler should not automatically run the bodies of required modules.  (This seems to match what MzScheme does, if I'm reading its documentation right, which is a factor because it has been hinted that R6RS modules will be based on MzScheme modules.)

The problem is that set-dispatch-macro-character is a function call, not a macro definition or even syntax.

A solution/work-around is to require reader.1 before compiling:
java kawa.repl -e '(require <reader1>)' -C reader2.scm
This doesn't work with CVS Kawa, but it works with some patches I'm hoping to check in this evening or tomorrow.

An alternative solution could make use of an '(eval-when (compile) ....)' form similar to ChezScheme's (and Common Lisps'), combined with load (rather than require).

Per Bothner <bothner>
Group administrator
Tue 15 Mar 2005 07:48:08 AM UTC, comment #1: 

You're sure this used to work ...  (not that it matters).
The problem is that there were multiple inconsistent readtables involved.  The solution is to change the way the
"current readtable" is accessed, which ends up being a little
bit involved, but hopefully I'm on the right track.

Per Bothner <bothner>
Group administrator
Mon 14 Mar 2005 07:50:09 PM UTC, original submission:  

Reader macros used in our (Merced Systems) source are no longer working with the latest Kawa sources.

I've attached a small patch that demonstrates the problem.  Here's what I'm getting now:

% make NEW=1 default
rm -f *.class
CLASSPATH=.:~/kawa/cvs/kawa-pure-build/kawa-1.7.91.jar java kawa.repl --warn-undefined-variable --main -C reader1.scm
(compiling reader1.scm)
CLASSPATH=.:~/kawa/cvs/kawa-pure-build/kawa-1.7.91.jar java kawa.repl --warn-undefined-variable --main -C reader2.scm
(compiling reader2.scm)
(set-dispatch-macro-character ...) called, I think.
reader2.scm:5:1: let has no value for 'a'
reader2.scm:5:12: invalid dispatch character '@'
make: * [reader2.class] Error 255

and here's what I get with a previous version of Kawa:

% make OLD=1 default
rm -f *.class
CLASSPATH=.:~/kawa/cvs/kawa-magnetic/kawa-1.7.90-m019-a.jar java kawa.repl --warn-undefined-variable --main -C reader1.scm
(compiling reader1.scm)
CLASSPATH=.:~/kawa/cvs/kawa-magnetic/kawa-1.7.90-m019-a.jar java kawa.repl --warn-undefined-variable --main -C reader2.scm
(compiling reader2.scm)
(set-dispatch-macro-character ...) called, I think.
CLASSPATH=.:~/kawa/cvs/kawa-magnetic/kawa-1.7.90-m019-a.jar java reader2
a: 100

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 #2729:  reader.diff added by dferreyra (568B - application/octet-stream - Small test case that exhibits the problem)

 

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-03-17 bothner StatusNone Invalid
    Open/ClosedOpen Closed
2005-03-15 bothner Assigned toNone bothner
2005-03-14 dferreyra Attached File- Added reader.diff, #2307

Back to the top

Powered by Savane 3.13-4b48.
Corresponding source code