[plt-dev] Re: [plt-bug] all/10233: error on RUN in BSL, apparently related to test engine

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon May 11 11:45:03 EDT 2009

(Do you want me to file another bug report?)

I don't know what "clever manipulation of source location" could  
mean, so I am posting the essence of the big-bang macro right here.  
As you can see I am doing _nothing_ with locations. Is it possible  
that I should use *syntax*/loc? (This may help with another bug I  
have re check-syntax and the new big-bang.)

-- Matthias



(define-syntax (big-bang stx)
   (syntax-case stx ()
     [(big-bang) (raise-syntax-error #f "bad world description" stx)]
     [(big-bang w s ...)
      (let* ([Spec (append AllSpec WldSpec)]
             [kwds (map (lambda (x) (datum->syntax #'here x)) (map  
car Spec))]
             [rec? #'#f]
             [spec (map (lambda (stx)
                          (syntax-case stx ()
                            [(kw . E)
                             (and (identifier? #'kw)
                                  (for/or ([n kwds]) (free- 
identifier=? #'kw n)))
                             (begin
                               (when (free-identifier=? #'kw #'record?)
                                 (syntax-case #'E ()
                                   [(V) (set! rec? #'V)]
                                   [_ (err 'record? stx)]))
                               (cons #'kw #;(syntax-e #'kw) (syntax  
E)))]
                            [_ (raise-syntax-error
                                'big-bang "not a legal big-bang  
clause" stx)]))
                        (syntax->list (syntax (s ...))))]
             ;; assert: all bind = (kw . E) and kw is constrained via  
Bind
             [args (map (lambda (x)
                          (define kw (car x))
                          (define co ;; patch from Jay to allow  
rename on import
                            (findf (lambda (n) (free-identifier=? kw  
(car n)))
                                   (map (lambda (k s) (cons k (cdr s)))
                                        kwds Spec)))
                          (list (syntax-e (car co)) ((cadr co) (cdr  
x))))
                        spec)])
        #`(send (new (if #,rec? aworld% world%) [world0 w]  #, at args)  
last))]))




On May 11, 2009, at 10:45 AM, Robby Findler wrote:

> I dropped bugs since this is not the same bug as the original PR.
>
> The problem appears to be a combination of the way big-bang expands
> and the way test coverage works. Here's a shorter program that I think
> illustrates this a little bit better:
>
> ;; BSL:
> (require 2htdp/universe)
> (define (clack ws x y action) 1)
> (define (main s) (big-bang s (on-mouse clack)))
> (clack 5 3 2 "leave")
>
> In this program, you see the identifier 'clack' in the definition of
> clack highlighted, as well as the 's' in the body of main.
>
> This is almost right -- the correct thing would have been to highlight
> the 'clack' in the argument to on-mouse instead of the other clack.
>
> Is it possible that the big-bang macro is doing somethign clever with
> source locations that confuses the test coverage?
>
> FWIW, the test coverage is simply updating some state somewhere with
> source location ranges in the editor and then coloring things based on
> what was executed in the fully expanded program. Perhaps it is worth
> looking at 'big-bang' and thinking about how source locations of
> syntax objects flow thru that expansion in those terms?
>
> Robby



Posted on the dev mailing list.