Here are some of my latest (failed) experiments:
#lang racket
(require (for-syntax racket/struct-info))
(require racket/pretty)
(struct foo (a b) #:transparent)
(displayln `("a foo object is transparent: I can see inside: \n (struct->vector (foo 1 2)) ~~> "
,(struct->vector (foo 1 2))))
(displayln `("syntax object is opaque I can't see inside: \n (struct->vector #'foo) ~~> "
,(struct->vector #'foo)))
;;; Why do two copies of the syntax display? (One copy
;;; is a side-effect. The other is a result).
;;; At expansion time, I can get some graphics in Dr-Racket for
;;; definition of foo, but I cannot get likewise
;;; not into the definition of syntax.
(begin-for-syntax
(displayln
(extract-struct-info
(syntax-local-value
#'foo)))) ; #'syntax))))
;;; But the access procedures for #'syntax are known!?!? (I just
;;; happen to know that there is a procedure named 'syntax-position';
;;; my whole issue is in trying to find out the list of all
;;; procedures defined in the system when the syntax type is created!)
(syntax-position #'42)
;;; Whereas #'foo is known in this module scope,
;;; (syntax struct:foo) is not known! Looks like the shorthand
;;; #'whatever for making a syntax object is known, but the longhand,
;;; presumably (syntax 'whatever), is not known.
(begin-for-syntax
(displayln
(extract-struct-info
(syntax-local-value
#'syntax))))
~~~~~~~~
Welcome to DrRacket, version 8.2 [cs].
Language: racket, with debugging; memory limit: 128 MB.
(.#<syntax:GSI/nanosim-apu-docs/WIKIS/BELEX_3/racket-sandbx-public.rkt:6:8 struct:foo> .#<syntax:GSI/nanosim-apu-docs/WIKIS/BELEX_3/racket-sandbx-public.rkt:6:8 foo> .#<syntax:GSI/nanosim-apu-docs/WIKIS/BELEX_3/racket-sandbx-public.rkt:6:8 foo?> (.#<syntax:GSI/nanosim-apu-docs/WIKIS/BELEX_3/racket-sandbx-public.rkt:6:8 foo-b> .#<syntax:GSI/nanosim-apu-docs/WIKIS/BELEX_3/racket-sandbx-public.rkt:6:8 foo-a>) (#f #f) #t)
. . ../../../../../../usr/share/racket/pkgs/errortrace-lib/errortrace/stacktrace.rkt:690:2: extract-struct-info: contract violation
expected: struct-info?
given: #<procedure:...rivate/template.rkt:563:0>
>