[plt-scheme] class init

From: Ivanyi Peter (pivanyi at freemail.hu)
Date: Fri Apr 14 09:06:01 EDT 2006

Robby Findler <robby at cs.uchicago.edu> írta:

> > I create a subclass and add a new init value to the class.
> > How can I check the value of the supplied init value
during the 
> > instantiation of the class? (For example the given value
> > satisfies
> > certain minimal requirements.)
> 
> So, for now, you'll have to manually
> put in a check.

How can I do that? (Maybe I am not understanding something
here.)
For example if I have a code like below, when this class is
instantiated
  (new my-canvas (my-callback (lambda (w e) #f)))
I would like to check that the given callback function has two
arguments. I would like to check that "in the class" and not
before I
instantiate a class.

(define my-canvas%
    (class canvas%
      (init (my-callback #f))
      ...
      (define (on-event event)
        ...
        (if my-callback
          (my-callback this event))
      )

      (super-new ...)
   )
)

Thanks,

Peter Ivanyi


_______________________________________________________________________________
Új Építésű ingatlanok, bankfüggetlen hitelajánlatok, kedvezményes konstrukciók:
http://ad.adverticum.net/b/cl,1,6022,97912,159457/click.prm




Posted on the users mailing list.