On Sat, Mar 20, 2004 at 12:58:25AM +0100, Simon Budig wrote:
> Manish Singh ([EMAIL PROTECTED]) wrote:
> > On Fri, Mar 19, 2004 at 10:50:23AM +0200, [EMAIL PROTECTED] wrote:
> > > On Fri, Mar 19, 2004 at 08:56:36AM +0100, Henrik Brix Andersen wrote:
> > > [stuff deleted]
> > > >
> > > > The only thing that struck me as missing was the work involved with
> > > > porting the plug-ins to the new API, but Rapha?l already pointed that
> > > > out in another reply to this thread.
> > >
> > > I very much hope that at least this time around, since so much is anyhow
> > > changed, the PDB will finally get the face lift and use named parameters
> > > instead of positional ones.
> >
> > A PDB revamp is planned.
> >
> > While on that subject, I'm wondering what a good way of representing
> > named parameters in scheme and perl would be. Any thoughts?
>
> Hmm, isn't there a perl-way to do named parameters? I bet there is (but
> I don't know about it).
> After a quick search on google the following seems to be "standard":
>
> gimp_perl_foo_bar (-image => image,
> -drawable => drawable,
> -radius => 5.5,
> -size => 300);
Yeah, I thought of that, but I'm not sure how you'd differentiate between
named usage and positional usage.
With both
gimp_perl_foo_bar($image, $drawable, 5.5, 300)
and
gimp_perl_foo_bar(-image => $image, -drawable => $drawable,
-radius => 5.5, -size => 300)
all perl hands the function is a list of values. CGI.pm tries to guess
about this, but it's easily fooled if the actual data string you give it
starts with '-'.
One way to do it would be:
gimp_perl_foo_bar({image => $image, drawable => $drawable,
radius => 5.5, size => 300})
And check if we get a hash reference as our first arg, but that seems
a bit nonobvious.
> For scheme we could do something like this:
>
> (script-fu-foo-bar '("image" image)
> '("drawable" drawable)
> '("radius" 5.5)
> '("size" 300))
>
> or (less clutter)
>
> (script-fu-foo-bar "image" image
> "drawable" drawable
> "radius" 5.5
> "size" 300)
>
> that having said: I don't have much experience with scheme outside
> script fu, so there might be a convention out there on how to do named
> parameters.
Again there is the problem of differeniating between positional
and named usage.
-Yosh
_______________________________________________
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer