[plt-scheme] image-snip initialization

From: Robby Findler (robby at cs.uchicago.edu)
Date: Thu Aug 3 18:26:19 EDT 2006

In order to make the (old style) positional arguments work with the
(new style) by name arguments, there are some confusing interactions
(and error messages). 

In this case, you have to propagate the arguments from the initializer
to Image-Snip% to the arguments to image-snip% via super-make-object,
which means you need to grab onto and re-send the arguments along.

Maybe this example helps?

(define Image-Snip%
  (class* image-snip% ()
    (init a b c d)
    (super-make-object a b c d)))

(define Image (make-object Image-Snip% "/Users/dr/test.jpg" 'jpeg #f #t))

I believe that the reason image-snip% hasn't been converted to use the
by-name arguments is the "case-lambda"-like initialization it has
already. In particular, the two argument case is completely different
from the 4 argument case, and that isn't handled well by `new'.


At Thu, 03 Aug 2006 17:38:15 -0400, David Richards wrote:
> Thanks for the previous response.  Let's try this again.
> (define Image-Snip%
>     (class* image-snip% ()
>       (super-instantiate ())))
> (define Image (make-object Image-Snip% "/Users/dr/test.jpg" 'jpeg #f 
> #t))
> This fails, but I really don't understand how or why.
> - dr
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.