racket / htdp

Other
91 stars 70 forks source link

HTDP Signatures - missing Image type in BSL #202

Open klauso opened 1 year ago

klauso commented 1 year ago

What version of Racket are you using? 8.10

What program did you run?

Images are an important type in the HTDP methodology. If the new signatures are supposed to be usable for teaching, a pre-defined type for images should be available.

(: foo Image)
(define foo (circle 5 "solid" "red"))

One can work around the issue using the predicate facility in signatures, but this does not work in BSL because it uses image? as a higher-order funciton.

(: foo (predicate image?))
(define foo (circle 5 "solid" "red"))
mfelleisen commented 1 year ago

@sorawee Thanks for the transfer.

Daniel Pattern and I will look into what to do about checked signatures once his test-drive at NU is over. An Image signature has been on our radar screen for a few weeks. (And no checked signatures are not types. They get checked at run time.)

mikesperber commented 1 year ago

This could probably be a starting point:

https://github.com/racket/deinprogramm/blob/master/deinprogramm/deinprogramm/sdp/image.rkt

klauso commented 1 year ago

Any hope that a new version of DrRacket that includes an Image signature will be released before mid of October (which is when my course using HTDP starts)?

mfelleisen commented 1 year ago

@klauso No our release cycle matches the North American college calendar.

klauso commented 1 year ago

I hope you'll also revise struct signatures in such a way that signatures can be added to struct constructors. My preference for teaching would be something like PLAI's define-type.

mfelleisen commented 1 year ago

(FWIW, I consider this a pedagogical mistake. Your students will confront Python on their first internship; developing mental discipline now will help.)

klauso commented 1 year ago

But according to that principle, adding signatures at all was already a mistake. But if you do add the option for signatures, you may just as well do it properly. Give the teachers some choices to tailor the teaching language to their own teaching method - that would be my preference.