[racket] Macro Stepper won't expand "nested" macros
Hello,
I recently posted this as a Stackoverflow question, but upon the advice of some of the commenters, I've decided to ask here instead. The SO question, for reference, is this one: http://stackoverflow.com/questions/13449842/why-doesnt-dr-racket-expand-nested-macros
What follows is the text of the question:__________________________________________________________________________________________
I am using Dr. Racket, version 5.3.1. I am trying to use the Macro Stepper feature, and am having problems with "nested" macros. (By "nested" macros, I mean macros that expand to a form which contains more (used-defined) macros. I don't know if this is the correct terminology). The macro stepper only expands these macros once, and then doesn't bother to continue expanding.
For example, I type the following into the Dr. Racket definitions area:#lang racket
(define-syntax foo
(syntax-rules ()
((foo a) 1)
((foo a stuff ...) (+ 1 (foo stuff ...)))))
(foo a b c d e)
Running this returns 5, as expected. Furthermore, typing (expand '(foo a b c d e)) in the Interactions window yields the syntax '(#%app + '1 (#%app + '1 (#%app + '1 (#%app + '1 '1)))), also as expected. However, going into the Macro Stepper (with standard macro hiding) and pressing the End button, I only see (+ 1 (foo b c d e)). If I disable macro hiding, I get the expected result, but also a whole lot of line noise that I'd rather not see.
Is this a bug, or expected behaviour? I swear that Dr. Racket didn't used to behave like this...
I actual submitted a bug report about this a month ago (http://bugs.racket-lang.org/query/?cmd=view&pr=13203), but then I started having second thoughts about whether it was a bug or not, so I decided to ask here.
PS - other random notes about this:
It seems to depend on whether or not the nested macro is the outer-most expression in the expanded form. For example, if I define (in addition to foo):(define-syntax bar
(syntax-rules ()
((bar xs ...) (foo xs ...))))
(define-syntax baz
(syntax-rules ()
((baz xs ...) (bar xs ...))))
(baz a b c d e)
Then the macro stepper shows me that (baz a b c d e) expands to (bar a b c d e) to (foo a b c d e) to (+ 1 (foo b c d e)), but then it stops.
The previous example might make you think it has something to do with macros that expand to themselves, but this doesn't appear to be the case. For example, if I redefine foo as follows:(define-syntax foo
(syntax-rules ()
((foo a) 1)
((foo a stuff ...) (+ 1 (blah stuff ...)))))
With(define-syntax blah
(syntax-rules ()
((blah xs ...) 10)))
Then (foo a b c d e) expands to (+ 1 (blah b c d e)) and then stops.__________________________________________________________________________________________
Thank you for your help,
Sandro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121120/253a9e01/attachment-0001.html>