I was trying to investigate the expansion behavior of a piece of code for which I just submitted a bug, and used the macro stepper. I was confused by what I saw. Here's the program:
#lang racket
(define (takes-kwd-arg #:kwd-arg opt)
(not opt))
(let ([named-val (takes-kwd-arg #:kwd-arg #t)])
named-val)
I ran the macro stepper button, and got this as the result of the step:
(module anonymous-module racket
(#%module-begin
(define (takes-kwd-arg #:kwd-arg opt) (not opt))
(let ([named-val
(let ((named-val takes-kwd-arg) (temp6 #t))
(if (variable-reference-constant? (#%variable-reference
takes-kwd-arg5))
(takes-kwd-arg3 temp6)
((checked-procedure-check-and-extract struct:keyword-procedure
named-val keyword-procedure-extract '(#:kwd-arg) 2)
'(#:kwd-arg)
(list temp6))))])
named-val)))
There are a bunch of identifiers without obvious binding instances here: for
instance, "takes-kwd-arg3". I'm guessing that these identifiers have binding
information that's not shown by the macro stepper.
What was much *more* confusing, though, was that when I turned *off* "Hide
Library Syntax", the bottom half suddenly turned into:
(module anonymous-module racket
(#%module-begin
(printing-module-begin (define (takes-kwd-arg #:kwd-arg opt) (not opt)))
(printing-module-begin (let ([named-val (takes-kwd-arg #:kwd-arg #t)])
named-val))))
... which suggested that "hiding Library Syntax" caused *more* detail to be
shown.
I've been mulling this over, and finally realized that when the box was
checked, I was seeing step 1 of 1. When the box was unchecked, I was seeing
only the first of several steps.
Can I suggest that it might be clearer what's going on if the macro stepper
displays something like "step <n> of <n>" somewhere? This might have clued me
in to my oversight.
John
smime.p7s
Description: S/MIME cryptographic signature
_________________________ Racket Developers list: http://lists.racket-lang.org/dev

