[ESS] = and test suites (was: Re: indentation when using = rather than <-)
A.J. Rossini
blindglobe at gmail.com
Sat Feb 4 11:10:56 CET 2006
Tim -
That's a hard one. Despite the fact that I think that the use of "="
(or "_") for assignment is a cardinal sin, I am not sure that the ESS
code is factored well to allow for simple replacement / additions of
"=" as assignment, and it should be. What I'd think about is looking
for uses of "_" for assignment in the lisp code for S/S-PLUS, and when
appropriate, replaceing them with "=".
On a side note, we really ought to have a test suite for font-locking.
I know we have (had?) some for SAS, but it would be good to have some
for the various "allowable" (heinous) approaches for coding that
S-PLUS and R allow, to make sure we get indentation right for
unbelievers.
best,
-tony
On 3 Feb 2006 14:27:37 -0800, Tim Hesterberg <timh at insightful.com> wrote:
> I'm trying to move away from using _ for assignment, but
> rather than <- I want to use =
> (for a number of reasons, the biggest of which is that <- is
> a barrier to new users adopting the S language).
>
> Unfortunately, ESS does not treat <- and = the same for
> indentation (example below).
>
> How would I get ESS to treat "=" the same as "<-" for purposes
> of indentation?
>
> I tried adding "=" to the ess-S-assign-ops variable, but that
> didn't seem to affect indentation. There is a comment in the
> definition of the variable suggesting the omission of "="
> is intentional, so I'm wondering about possible negative ramifications
> of modifying the ESS code to make indentation work as I like.
>
> --------------------------------------------------
> Example:
>
> If I create the following functions with
> no initial blanks, then run ess-indent-exp from the beginning
> of each function, I get the following; I'd like indenting the
> second version to be similar to indenting the first.
>
> f <- function(x){
> a
> if(b){
> c <- foo1(x = 2, y = 3, foo2(z = mean(x)),
> a, b = 5)
> for(i in 1:n)
> d[i] <- foo3(z, foo4(a = 3,
> b =
> 5, c, foo5(d)))
> }
> }
>
> f = function(x){
> a
> if(b){
> c = foo1(x = 2, y = 3, foo2(z = mean(x)),
> a, b = 5)
> for(i in 1:n)
> d[i] = foo3(z, foo4(a = 3,
> b =
> 5, c, foo5(d)))
> }
> }
>
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>
--
best,
-tony
blindglobe at gmail.com
Muttenz, Switzerland.
"Commit early,commit often, and commit in a repository from which we can easily
roll-back your mistakes" (AJR, 4Jan05).
More information about the ESS-help
mailing list