racket / htdp

Other
91 stars 69 forks source link

DrRacket stepper doesn't work with BSL in presence of ... (templates) #159

Closed wilbowma closed 2 years ago

wilbowma commented 2 years ago

What version of Racket are you using? 8.0 cs -- 8.2.0.2 cs

What program did you run? The following BSL programs trigger the bug when trying to run the stepper

(define (fn-for-loc)
  (...))
(+ 4 5)

The smallest examples is:

(...)

but I'm not sure what I'd expect this to do.

What should have happened? The stepper should step through the (+ 4 5) expression.

If you got an error message, please include it here. The stepper reports:

annotate: unexpected syntax for expression: (cons 'quote-syntax (cons empty (cons '#:local empty)))

Please include any other relevant details macOS various versions; linux

mfelleisen commented 2 years ago

My memory is that it never did, and I question this as a feature request. (If we do implement it, we have to bind ... to something at run-time to keep the stepper intact as is.)

samth commented 2 years ago

This program works properly in the stepper in 7.8 and 7.3, the two older versions I have lying around.

But even if it didn't, having the stepper not work at all for this program and give an incomprehensible error would not be an ok thing to give to students.

mfelleisen commented 2 years ago

Well my memory is wrong :-) [[ Of course I agree about the error message. ]]

jbclements commented 2 years ago

Yes. I believe I can spend 2 hours looking at this today. That probably won’t be time to fix it, but I might know more.

John

On Sep 29, 2021, at 04:39, Matthias Felleisen @.***> wrote:

Well my memory is wrong :-) [[ Of course I agree about the error message. ]]

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

jbclements commented 2 years ago

Okay, I see most of what's going on. The annotation of ellipses ("...") has changed somewhat. It has two issues. The first is the introduction of a new top-level form (lifted/2), etc. The second is a special-case for ellipses used inside parens. In both cases the standard solution of using a stepper-mark doesn't work, because the outer form disappears before it reaches the annotater. Ugh.

samth commented 2 years ago

See also racket/drracket#143.

jbclements commented 2 years ago

progress on this yesterday, I now understand the way in which the syntax system combines marks when syntax objects are transformed (by consing them together). I believe this was not the case when I wrote this code in like 1887 or something. Regardless, I believe I now have a clear path to eliminating the crash. Hiding the lifted thing will probably take a bit more thinking, but doesn't seem insurmountable. The first thing to make sure is that "fixing" the property lookup w.r.t. the consing behavior doesn't break something else that accidentally worked because of it.

jbclements commented 2 years ago

Fixed by 30bf5547d67c2e2a95

wilbowma commented 2 years ago

Thanks! Can this be fixed by a raco update or will we need to install a snapshot?

samth commented 2 years ago

I think the following will update it, but I can't guarantee that the resulting code will work (I think it will, though):

raco pkg update --catalog https://pkgs.racket-lang.org htdp-lib
wilbowma commented 2 years ago

Okay, I'll test it out; thanks!

wilbowma commented 2 years ago

nope, I get a lot of build errors.

samth commented 2 years ago

What kind of build errors?

On Tue, Oct 5, 2021, 12:20 PM 'William J. Bowman' via samth < @.***> wrote:

nope, I get a lot of build errors.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/racket/htdp/issues/159#issuecomment-934560570, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB3X42IONDLB6B3U2TKWNDUFMQV5ANCNFSM5FMBD4BQ .

-- To unsubscribe from this group and stop receiving emails from it, send an email to @.***

wilbowma commented 2 years ago
workspace/racket-dev/racket/share/pkgs/htdp-lib/test-engine/markup-gui.rkt:104:12: number-snip:number->string/snip: unbound identifier
  in: number-snip:number->string/snip
workspace/racket-dev/racket/share/pkgs/htdp-lib/lang/private/provide-and-scribble.rkt:132:53: except-in: identifier `posn' not included in nested require spec
  at: (submod lang/private/intermediate-funs)
workspace/racket-dev/racket/share/pkgs/htdp-lib/htdp/bsl/runtime.rkt:149:21: print-value-columns: unbound identifier
  in: print-value-columns

It's very probably my fault; this machine is on a 8.0 HEAD build. I'll try again from 8.1

samth commented 2 years ago

I would try 8.2, I would not expect earlier than that to work.

On Tue, Oct 5, 2021, 12:30 PM 'William J. Bowman' via samth < @.***> wrote:

workspace/racket-dev/racket/share/pkgs/htdp-lib/test-engine/markup-gui.rkt:104:12: number-snip:number->string/snip: unbound identifier in: number-snip:number->string/snip

workspace/racket-dev/racket/share/pkgs/htdp-lib/lang/private/provide-and-scribble.rkt:132:53: except-in: identifier `posn' not included in nested require spec at: (submod lang/private/intermediate-funs)

workspace/racket-dev/racket/share/pkgs/htdp-lib/htdp/bsl/runtime.rkt:149:21: print-value-columns: unbound identifier in: print-value-columns

It's very probably my fault; this machine is on a 8.0 HEAD build. I'll try again from 8.1

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/racket/htdp/issues/159#issuecomment-934569168, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB3X4YMCCOIR34IL2XU6M3UFMR4DANCNFSM5FMBD4BQ .

-- To unsubscribe from this group and stop receiving emails from it, send an email to @.***

wilbowma commented 2 years ago

Okay thanks

mfelleisen commented 2 years ago

Ben L. tried it here on 8.2 and it worked for him.

wilbowma commented 2 years ago

Ben posted in the Slack that he ran into the second error, about posn, too on 8.2. Are we sure this didn't introduce a bug?

blerner commented 2 years ago

I tried @samth's raco pkg update line and (a) the installation failed with the second warning @wilbowma received about missing posn definitions (but neither of the other two), and (b) DrRacket worked and stepped through templates correctly. I initially dismissed the warning about posns as merely being a warning in building docs or something, but then when I tried to build a scribble site, scribble failed as well with the same error.

I saved the console output of the raco pkg update command (with all its error messages) and can forward that along to anyone if it's of any use...

jbclements commented 2 years ago

I've just been through the slack discussion, and I'm not sure I have a set of steps for reproducing the "posn problem". It looks like it might be sufficient to download a fresh 8.2 and use raco pkg update, does that sound right? I'll give it a try, but only if someone tells me that I'm reading this plausibly.

wilbowma commented 2 years ago

I think that should reproduce the problem.

wilbowma commented 2 years ago

You'll want to use this raco update command: raco pkg update --catalog https://pkgs.racket-lang.org htdp-lib

jbclements commented 2 years ago

Okay, yes, I do see these errors. My current supposition is that this is because there are changes to htdp that depend on changes made to other packages, most likely racket itself. My hope is that these errors won't occur when we build 8.3 from source. Thinking about this more carefully, it would have made more sense just to say "let's try building from source, and seeing whether the error persists."

wilbowma commented 2 years ago

I rebuilt from HEAD and it seems to work; thanks!