#:kind (list ... ) in defthing and defproc

36 views
Skip to first unread message

Jos Koot

unread,
Sep 26, 2020, 3:07:01 PM9/26/20
to Racket Users
The following works well in DrRacket, version 7.8 [3m]

#lang scribble/manual
@deftogether[
(@defthing[#:kind "constant false/on/high" F trit? #:value '0]
 @defthing[#:kind (list "constant true/off/low" (hspace 1)) T trit? #:value '1]
 @defthing[#:kind "constant indeterminate" ? trit? #:value '?]
 @defthing[#:kind (list "constant" (hspace 13)) trits (list/c trit? trit? trit?) #:value (list F T ?)]
 @defthing[#:kind (list "constant" (hspace 13)) in-trits sequence? #:value (in-list trits)]
 @defproc[#:kind (list "predicate" (hspace 12)) (trit? (obj any/c)) boolean?]
 @defproc[#:kind (list "predicate" (hspace 12)) (F? (obj any/c)) boolean?]
 @defproc[#:kind (list "predicate" (hspace 12)) (T? (obj any/c)) boolean?]
 @defproc[#:kind (list "predicate" (hspace 12)) (?? (obj any/c)) boolean?])]{}

I use hspace for alignment of the kinds.

But in version 7.8.0.10--2020-09-25(515012525c/a) [3m] I get:

. . C:\Program Files\Racket-7.8.0.10\collects\syntax\contract.rkt:101:21: defthing: contract violation
  expected: (or/c string? #f)
  given: ("constant true/off/low" #(struct:element hspace (" ")))
  in: (or/c string? #f)
      macro argument contract on #:kind argument
  contract from:
      (lib scribble/private/manual-proc.rkt)
  blaming: E:\circuits\circuit-manual.scrbl
   (assuming the contract is correct)
  at: E:\circuits\circuit-manual.scrbl:416.18

Because I don't know whether or not this is a known issue, I post it on this list.
If this is a known issue or an intentional change, then ignore this email, please.
If not I can post it as a racket issue.
Let me know, please.
Thanks, Jos

Matthew Flatt

unread,
Oct 7, 2020, 9:40:25 AM10/7/20
to Jos Koot, Racket Users
A recent commit added a contract on `defthing` and `defproc` to enforce
the documented constraint that `#:kind` should be a string. But the
implementation is happy with content in the sense of `content?`.

Since it's easy to adjust the contract and documentation to restore
this capability, I'll do that, and then this example works again.

Matthew
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CAL6KNi3P251G%2BBMQqDbo2qt6K22Gw
> _OOgjjnHDboLLuC3qKrGg%40mail.gmail.com.

Jacob Jozef

unread,
Oct 7, 2020, 10:03:08 AM10/7/20
to Matthew Flatt, Racket Users

Thanks Matthew, that’s great.

Jos

Robby Findler

unread,
Oct 7, 2020, 1:33:34 PM10/7/20
to Matthew Flatt, Jos Koot, Racket Users
Ah, sorry! I missed that `content?` was okay. Thanks, Matthew!

Robby


Reply all
Reply to author
Forward
0 new messages