[Qgis-developer] Expression engine functions and naming

Denis Rouzaud denis.rouzaud at gmail.com
Thu Jun 19 22:31:43 PDT 2014


On 20.06.2014 06:19, Nyall Dawson wrote:
> Hi all,
>
> I thought I'd raise an issue which has been on my mind a bit lately,
> and I'm not sure how to proceed with fixing it. At the moment there's
> a huge lack of consistency in function names in the QGIS expression
> engine. Here's some examples:
>
> - Some functions use the naming convention of seperating lowercase
> words with underscores, for example "format_number", "format_date",
> "color_rgb"
> - Others use all lowercase, no underscore, eg "tostring", "wordwrap"
> - Still others use camel case, eg "geomFromWKT", "symDifference"
>
> Basically, we've got a mix of every naming convention possible. I
> think there's an urgent need for us to choose a convention and ensure
> that all newly introduced functions adhere to this.
>
> The follow up question is whether or not we can clean up this mess.
> Can we rename functions in a way that doesn't negatively impact users?
> Possibly we could have aliases for functions which evaluate ok so that
> older projects can still work, but which aren't shown the the user in
> the dialog.
+1 if possible
>
> There's also some function names & formats which really bug me, specifically:
> - "$feature", "$numfeatures". Ideally these should be named something
> more appropriate like "$atlas_feature_num" and "$atlas_feature_count",
> since they directly relate to atlas variables. From their names it
> seems more logical that these would return the current feature and
> number of features in the current layer.
can't we use the same alias idea for this?
> - I made a dumb decision when I created the "clamp" function and put
> the parameters in the "minimum,input,maximum" order. In retrospect
> these should be "input,minimum,maximum"
Regarding clamp, since this was added during developpement phase and 
nothing was released since, I would vote for changing it now.
People using master know this might happen. Just send a mail to the list 
saying this.

Cheers,

Denis


More information about the Qgis-developer mailing list