[plt-scheme] Ancestor Visibility Of A Mixin Generated Class

From: Ray Racine (ray.racine at comcast.net)
Date: Fri Oct 26 11:22:28 EDT 2007

Based on the sequence below the question is:

How do I, in effect create a c3% with an (inspect #f) granting
visibility into c1% and c2%.  i.e., (class-info c3%) shows f1 and f2.

Note[1]: c4% is a sort of work around effort which does succeed in
creating a class via a mixin secondarily but with only half of the
desired visibility.  

Note[2]: Should not c4% be completely opaque to c1% and c2%?

(module ctest mzscheme
  
  (require (lib "class.ss"))
  
  (define c1%
    (class* object% ()
      (inspect #f)
      (init-field f1)))
  
  (define c2%
    (class* object% ()
      (inspect #f)
      (init-field f2)))
  
  (define c3%
    ((mixin () ()
       c1%)
     c2%))
  
  (define c4%
    (class* c3% ()
      (inspect #f)))
  
  )

Welcome to DrScheme, version 371.3-svn22oct2007 [3m].
Language: (module ...).
> (class-info c1%)
c1%
1
(f1)
#<primitive:object:c1%-ref>
#<primitive:object:c1%-set!>
#f
#t
> (class-info c2%)
c2%
1
(f2)
#<primitive:object:c2%-ref>
#<primitive:object:c2%-set!>
#f
#t
> (class-info c3%)
. class-info: current inspector cannot inspect class: #<struct:|
class:...epper-tool.ss:583:8>:16:5|>
> (class-info c4%)
c4%
0
(f2)
field-ref
field-set!
#<struct:class:c2%>
#t
> 




Posted on the users mailing list.