[racket users] describe variant issue?

46 views
Skip to first unread message

Kevin Forchione

unread,
Sep 15, 2020, 5:47:17 PM9/15/20
to Racket-Users List
Hi guys,
I’m not sure why the describe library’s variant is always returning ‘simple regardless of numeric value. For instance, the docmentation says:

(variant 1) -> fixnum-integer

But when I run it under Dr Racket 7.8 [cs] it returns ‘simple for this, as well as for 10.3  as well as pi, 2/3, and 0+1i.

Any ideas why this is happening?

Thanks!

Kevin

Sam Tobin-Hochstadt

unread,
Sep 15, 2020, 6:11:41 PM9/15/20
to Kevin Forchione, Racket-Users List
This is a difference in behavior between Racket BC and Racket CS, and
not something in the describe library:

[samth@homer:~/work/teaching/c211 (master) racket-7.8] racket
Welcome to Racket v7.8.
> (struct->vector 5)
'#(struct:fixnum-integer ...)
> ^D
[samth@homer:~/work/teaching/c211 (master) plt] racket
Welcome to Racket v7.8.0.9 [cs].
> (struct->vector 5)
'#(struct:simple ...)
> --
> 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/367E5C0C-FA1C-4546-A586-54135D264C6B%40gmail.com.

Kevin Forchione

unread,
Sep 17, 2020, 1:17:19 PM9/17/20
to Racket-Users List


> On Sep 15, 2020, at 3:11 PM, Sam Tobin-Hochstadt <sa...@cs.indiana.edu> wrote:
>
> This is a difference in behavior between Racket BC and Racket CS, and
> not something in the describe library:
>
> [samth@homer:~/work/teaching/c211 (master) racket-7.8] racket
> Welcome to Racket v7.8.
>> (struct->vector 5)
> '#(struct:fixnum-integer ...)
>> ^D
> [samth@homer:~/work/teaching/c211 (master) plt] racket
> Welcome to Racket v7.8.0.9 [cs].
>> (struct->vector 5)
> '#(struct:simple …)


Is this going to be the go-forward stance for Racket? Or is this still a work in progress? Will it be left up to the code to determine types through predicate checking?

Thanks!

Kevin

Sam Tobin-Hochstadt

unread,
Sep 17, 2020, 1:30:22 PM9/17/20
to Kevin Forchione, Racket-Users List
We may change Racket CS so that it produces the same results, but in
general the results of `struct->vector` on values that are opaque is
not something that should be relied on.

The describe library is, I believe, unmaintained, and hasn't been
updated in many years.

Sam
> --
> 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/F42194F9-ADA3-4158-BCBA-3A65F2108AB4%40gmail.com.

Matthew Flatt

unread,
Sep 17, 2020, 1:33:57 PM9/17/20
to Kevin Forchione, Sam Tobin-Hochstadt, Racket-Users List
A PR to improve `struct->vector` for CS would be welcome. There
relevant code is here:

https://github.com/racket/racket/blob/master/racket/src/cs/rumble/struct.ss#L1221

As you'll see, the synthesized name is currently whatever comes out of
Chez Scheme's `inspect/object` interface. It could instead involve a
case dispatch on fixnums, bignums, etc., to improve on the `simple`
label that `inspect/object` produces. There may also be Chez Scheme
versus Racket terminology to bridge, such as `byte-string` instead of
`bytevector`.
> https://groups.google.com/d/msgid/racket-users/CAK%3DHD%2BaiK06QrfOc2FLjTCFzvvo
> -cPpbSGChQ9yAnon_tp6wVw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages