[ESS] proposal re: underscore

Martin Maechler maechler at stat.math.ethz.ch
Sat Apr 7 18:21:44 CEST 2012


On Sat, Apr 7, 2012 at 12:21, Stephen Eglen <S.J.Eglen at damtp.cam.ac.uk> wrote:
>
>> Anything that encourages people to use <- for assignment instead of =
>> is a good thing, because it makes for more readable code, and I have
>> tools that require it, in particular for creating an emacs TAGS file.
>
> Slightly off topic, but a nice way of making TAGS files is using 'R CMD
> rtags', from Deepayan:
>  http://developer.r-project.org/rtags.html
>
> This recognises functions defined either with '<-' or '='.
>
> Stephen

Yes, indeed.   Thank you for reminding us Stephen.
But that only works because it uses R itself to parse  all the R source files.
Really it's the  rtags() function in R
and
   ?rtags
quickly tells you that indeed it's using R's own parser.

Apart from that (using R itself), it's   "practically impossible"
to correctly distinguish  the  assignment-"=" from the other (two
cases of) "=" used for function calls and function argument lists.

That's why using  "<-"  and "="  each for their own cases makes such
code much more readable
and also Emacs-parseable, indentable,  imenu-indexable, etc etc e t c

Martin



More information about the ESS-help mailing list