After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 71200 - PDB should be changed to use named parameters
PDB should be changed to use named parameters
Status: RESOLVED OBSOLETE
Product: GIMP
Classification: Other
Component: Plugins
git master
Other All
: Normal enhancement
: Future
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks: 101604
 
 
Reported: 2002-02-11 18:00 UTC by Dov Grobgeld
Modified: 2018-05-24 10:40 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Dov Grobgeld 2002-02-11 18:00:49 UTC
The following is a proposal that I sent in years ago, just prior to the
release of 1.0. Unfortunately it was turned down because of the huge
breakage that would be the result of it.

The current PDB has parameters that are position dependent. This is a very
inflexible and tedious interface. E.g. gimp_text has 17 parameters. A user
that would like to use this interface has to fill in a lot of parameters,
most of which she would be happy to use the default values of. Of course
there is no way to remember these parameters when writing scripts, and
instead one must resort to tedious copy and paste, and a result the signal
to noise ratio in the code is high.

A much better approach is to use "named parameters", or key/value pairs as
they are sometimes known. When these are used all parameters have default
values, and only those values that should be changed are given in the PDB call.

E.g. instead of doing the call

    gimp_bucket_fill(drawable, FG_BUCKET_FILL, NORMAL_MODE, 0.1, 13,
                     1, 100, 100)

where one must reference the manual to understand the parameters, the
following call would be made:

    gimp_bucket_fill("drawable", drawable,
                     "x",        100,
                     "y",        100)

Most paramaters have default values and only the values that are overridden
are listed. This is a much clearer interface.

It would probably be possible to create an implementation that is backwards
compatible, e.g. by checking if the first parameter is a string, and
only then interprete the rest of the parameters as a key, value pair list.

Key/values is really the natural interface to commands and interfaces, and
 a future Gimp should support it.
Comment 1 Sven Neumann 2002-02-11 18:44:51 UTC
Not actually a new idea and discussed several times. 
At the moment scheduled for GIMP-2.0.
Comment 2 Hans Breuer 2002-12-06 14:50:21 UTC
Could probably benefit from gimp_set_last_values() -
a function to be called after a plug-in finished - too.
see bug #51937
Comment 3 Sven Neumann 2006-03-30 06:05:23 UTC
Just a quick note that we have come one step closer to this noble goal. Mitch has cleaned up the PDB internals as well as the perl code used to generate the PDB code. Internally the PDB now uses GParamSpec and GValue. These changes are not exposed to libgimp though. We plan to introduce an alternative PDB API in the next development cycle (after 2.4).
Comment 4 Thomas Hotz 2013-06-18 08:06:34 UTC
Just a question: Will this feature come with GEGL?
Comment 5 Michael Natterer 2013-06-18 08:37:00 UTC
No it's completely unrelated. Comment 3 stays true, except we redefine
"next development cycle" all the time :)
Comment 6 Thomas Hotz 2013-06-18 10:43:37 UTC
Michael Natterer, thank you very much for explaining.
Comment 7 GNOME Infrastructure Team 2018-05-24 10:40:05 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gimp/issues/18.