[plt-scheme] Documentation inconsistencies? [was: Create new inspector hierarchies?]

From: Derick Eddington (derick.eddington at gmail.com)
Date: Sat Apr 7 23:45:32 EDT 2007

Thanks!  Being able to create custom inspection facilities is

In the MzScheme documentation section 4.4 paragraph about the structure
type property guards, it says: "The list contains the values that
struct-type-info would return for the new structure type if it skipped
the current-inspector control check".  I am curious about the
implications of this skip of the current-inspector control check so I
made the below code, and by doing so I think I might have found some
documentation inconsistencies:

1) In my code below, `be-sneaky' does not get access to the
super-struct-type, but if the current-inspector control check is skipped
when making the list of values given to the `prop:sneaky' property
guard-proc, shouldn't this list's value for the super-struct-type be
`struct:s' because the current-inspector control check was skipped?

2) Exploring #1 further, I made `hmm' and found that in the list of the
values from struct-type-info, the init-field-k and auto-field-k values
are not consistent with the documentation, which says these values are
the number of fields "not counting fields created by its ancestor
types", because the print-out shows these values are counting ancestor

(module A mzscheme
  (define-struct S (a b))
  (provide (struct S ())))

(module B mzscheme
  (require A
           (lib "struct.ss")
           (lib "match.ss"))
  (define-values (prop:sneaky prop:sneaky? prop:sneaky-accessor)
     (λ (ignored type-info) 
  (define-struct/properties (sub-S S) ()
    ([prop:sneaky 'ignored]) #f)
  (define (be-sneaky ss)
    (match-let ([(name init-k auto-k accessor mutator immutable-k super skipped?)
                 (prop:sneaky-accessor ss)])
      (struct-type-info super)))
  (define (hmm ss)
    (printf "(struct-type-info struct:sub-S) => ~s\n" 
            (call-with-values (λ () (struct-type-info struct:sub-S)) list))
    (printf "(prop:sneaky-accessor ss) => ~s\n" (prop:sneaky-accessor ss)))
    (struct sub-S ())

(require B)
(define ss (make-sub-S 1 2))
(hmm ss)
(be-sneaky ss)

;; print out:
(struct-type-info struct:sub-S) => (sub-S 2 -2 #<primitive:sub-S-ref> #<primitive:sub-S-set!> () #f #t)
(prop:sneaky-accessor ss) => (sub-S 2 -2 #<primitive:sub-S-ref> #<primitive:sub-S-set!> () #f #t)
;; error: 
struct-type-info: expects argument of type <struct-type>; given #f

: Derick

Posted on the users mailing list.