htdp icon indicating copy to clipboard operation
htdp copied to clipboard

Using stepper on template

Open chgus0202 opened this issue 3 years ago • 8 comments

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!

chgus0202 avatar Feb 19 '22 10:02 chgus0202

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

AlexKnauth avatar Feb 19 '22 21:02 AlexKnauth

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 avatar Jul 11 '22 09:07 sorawee

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

sorawee avatar Jul 11 '22 09:07 sorawee

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 avatar Jul 11 '22 18:07 jbclements

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

jbclements avatar Jul 11 '22 18:07 jbclements

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.

jbclements avatar Jul 14 '22 10:07 jbclements

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.

mfelleisen avatar Jul 14 '22 11:07 mfelleisen

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.

jbclements avatar Jul 14 '22 15:07 jbclements