racket / scribble

Other
199 stars 91 forks source link

Run Resyntax on scribble/private #364

Closed jackfirth closed 1 year ago

jackfirth commented 1 year ago

This one is a continuation of #363, this time expanded to the entire scribble/private collection.

mflatt commented 1 year ago

These improvements look really good — thanks!

mfelleisen commented 1 year ago

If resyntax also tore apart 2,000 line syntax functions, it would be perfect :-)

rfindler commented 1 year ago

I am a little bit hesitant of the (-> any/c boolean?) to predicate/c transformation. I feel like the former is easier to read.

Robby

jackfirth commented 1 year ago

I am a little bit hesitant of the (-> any/c boolean?) to predicate/c transformation. I feel like the former is easier to read. Robby

I agree with this, actually. It's a little weird that predicate/c exists at all. The docs say it's because it offers some optimizations to avoid wrappers for struct type predicates. But could we just make -> smart enough to recognize (-> any/c boolean?) as a special case and avoid wrappers for that too? Then predicate/c would be obsolete.

rfindler commented 1 year ago

Looks like it does! yay. :)

#lang racket
(struct s ())
(eq? (contract (-> any/c boolean?) s? 'pos 'neg) s?) ;; => #t
jackfirth commented 1 year ago

Perfect! Then I think it's time to update the docs for predicate/c to say it's now an obsolete alias for (-> any/c boolean?), and the latter should just be used directly instead.