[QGIS-Developer] Variable syntax: $ vs @

Neumann, Andreas a.neumann at carto.net
Mon Jun 19 05:36:45 PDT 2017


Hi Nathan, 

Thank you for the explanation. Makes sense. I will pass this on in the
workshop. 

Andreas 

On 2017-06-19 14:12, Nathan Woodrow wrote:

> 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 [1]
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer [1]

  

Links:
------
[1] 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/9a0b4e46/attachment.html>


More information about the QGIS-Developer mailing list