Skip to content

recognize and use prop:constructor-style-printer when converting structs#6

Open
AlexKnauth wants to merge 1 commit intoracket:masterfrom
AlexKnauth:prop-constructor-style-printer
Open

recognize and use prop:constructor-style-printer when converting structs#6
AlexKnauth wants to merge 1 commit intoracket:masterfrom
AlexKnauth:prop-constructor-style-printer

Conversation

@AlexKnauth
Copy link
Member

This changes print-convert to work with my other pull request to racket (racket/racket#1337) so that it can recognize the new prop:constructor-style-printer property and use it when converting structs that have it.

> (require racket/struct mzlib/pconvert)
> (struct point (x y) ; this struct is opaque and wouldn't print like this otherwise
    #:property prop:constructor-style-printer
    (list
     (lambda (p) 'point)
     (lambda (p) (list (point-x p) (point-y p)))))
> (print-convert (point 1 2))
(list 'point 1 2)
> (constructor-style-printing #true)
> (print-convert (point (list 1 2 3) (list 4 5 6)))
(list 'point (list 'list 1 2 3) (list 'list 4 5 6))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant