[plt-scheme] image-snip initialization
At Thu, 03 Aug 2006 19:02:24 -0400, David Richards wrote:
> Well it helps a little, thanks. But using the PLT object system makes
> me feel like I'm collecting idioms like a philatelist collects stamps.
> Shouldn't object systems should be designed not by piling feature on
> top of feature, but by removing the weaknesses and restrictions that
> make additional features appear necessary?
We've tried to do that (and there will be a paper that makes this very
argument about the mz class system, but I'll let Matthew tell you more
about that one as he wishes), but there are some concessions to
backwards compatibility (like new vs make-object vs instantiate)
Do keep in mind that we've been thru 3 major revisions of this object
system over more than 10 years.
> On Aug 3, 2006, at 6:26 PM, Robby Findler wrote:
>
> > 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% ()
> >
> do i do augments and overrides here?
>
> > (init a b c d)
>
> or here?
>
> > (super-make-object a b c d)
>
> or here?
You can put methods anywhere into the body, as you see fit.
The ordering only matters for the expressions (and controls their
evaluation). The ordering of methods and inherit declarations is
entirely up to you.
> > ))
> >
> > (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'.
>
> I wondered about that.
>
> http://www.fotosearch.com/comp/CRT/CRT388/15455-50dg.jpg
Too bad we didn't know where the door was when we started.
Robby