PDB should be changed to use named parameters
Submitted by Dov Grobgeld
Description
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.
Version: git master