[QGIS-Developer] Variable syntax: $ vs @

Nathan Woodrow madmanwoo at gmail.com
Mon Jun 19 05:12:07 PDT 2017


Hey Andreas,

They are really two different things.  $geometry is really a function that
takes no arguments. This has been deprecated in favour calling with ()
e.g geometry().
 @ is only for variables.

So you can explain it that $ used to be a shorthand way of calling a
function that took no arguments which has now been replaced with () at the
end to call it. $area = area().  This becomes important because now we
support optional arguments meaning you can take 0 to N arguments.

- Nathan

On Mon, Jun 19, 2017 at 9:53 PM, Neumann, Andreas <a.neumann at carto.net>
wrote:

> Hi,
>
> While preparing for a workshop on expressions I wonder how to explain why
> some variables are referenced with the $ sign (like $geometry) while other
> variables start with the @ sign, like @row_number, @layer_name.
>
> I know that it has historical reasons and that variables with the @ sign
> are newer and are implemented using a different technology.
>
> But are there plans to get rid of the old $ sign notation and move
> everything to the @ sign notation?
>
> Just wonder how I best explain this to the participants of the workshop.
>
> Thanks for your reply,
>
> Andreas
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170619/89199e70/attachment-0001.html>


More information about the QGIS-Developer mailing list