racket / htdp

Other
91 stars 69 forks source link

Using stepper on template #168

Open chgus0202 opened 2 years ago

chgus0202 commented 2 years ago

Hi, I am a student taking BSL language at school and I would like to report a problem using stepper on a template.

It seems like ... in the template confusing the stepper which is supposed to be part of the infrastructure and I wonder if you can look into this problem

error

(eg,

(define (fn-for-function f) (cond [ (false? f) (....) ] ) [else (... f)] ))

Thank you!

AlexKnauth commented 2 years ago

I believe this issue should be transferred to the htdp repository: https://github.com/racket/htdp

sorawee commented 2 years ago

Seems like (quote-syntax ... #:local) is not handled. I thought I saw this kind of issue fixed already, but that's clearly not the case.

sorawee commented 2 years ago

Ah, it was #159, which fixes the problem for that program, but the issue persists for more complicated programs.

(...) ;; OK

(cond [#t (...)]
      [else 1])
;; annotate-inner: nothing expands into begin! : (cons 'begin (cons (cons 'quote (cons 1 '())) '()))

(cond [#t (...)])
;; recon-source: no matching clause for syntax: (quote-syntax () #:local)

Regardless of fixes elsewhere, I think (quote-syntax ... #:local) should be handled in places like https://github.com/racket/htdp/blob/master/htdp-lib/stepper/private/annotate.rkt#L843

jbclements commented 2 years ago

Okay, yeah, I see the problem. I had tests with dots in parens, but only at the top level of lambdas where the inserted "begin" gets vacuumed away.

jbclements commented 2 years ago

well, that's the issue with the first example, anyway....

jbclements commented 2 years ago

Whoa... I've now spent about 10 hours debugging (okay actually probably 15 or 20) and I'm finding all kinds of interesting stuff. One or two serious bugs that have been lurking for a long long time. Yikes.

mfelleisen commented 2 years ago

My guess is that the stepper is exercised in minimal ways, which is one possibility why these bugs have been around forever. Nobody besides me uses it beyond the first two weeks or so around here.

jbclements commented 2 years ago

I think I'm going to take the next 10 students that come through my door looking for a senior project and tell them to fuzz-test the stepper.