[plt-scheme] circumvented inspector

From: Jos Koot (jos.koot at telefonica.net)
Date: Sat Aug 18 04:23:36 EDT 2007

Hi,
Given a module that wants to provide an opaque struct-type. When required from a module there is no way to circumvent the opaqueness, because the invoked module is executed before the invoking unit is executed. Hence the invoking unit cannot play with inspectors before the invoked unit is executed. But at top level it is possible to circumvent the opaqueness. See the example below. Is this simply a top level problem, or is there a some way to make structs provided by a module realy opaque for the top level?
Jos Koot

; module a required within module b
(module a mzscheme
 (define-struct a () #;(current-inspector))
 (provide (all-defined)))
(module b mzscheme
 (define ci (current-inspector))
 (current-inspector (make-inspector))
 (require a)
 (current-inspector ci)
 (printf "~s~n" (struct? (make-a)))) ; #f, ok
(require b)

; module c required at top level
(module c mzscheme
 (define-struct c () #;(current-inspector))
 (provide (all-defined)))
(define ci (current-inspector))
(current-inspector (make-inspector))
(require c)
(current-inspector ci)
(printf "~s~n" (struct? (make-c))) ; #t
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20070818/51f03662/attachment.html>

Posted on the users mailing list.