[R] Is = now the same as <- in assigning values

Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Fri Dec 19 01:33:47 CET 2008


Stavros Macrakis wrote:
> On Thu, Dec 18, 2008 at 1:37 PM, Wacek Kusnierczyk <
> Waclaw.Marcin.Kusnierczyk at idi.ntnu.no> wrote:
>
>   
>   
>> who said = is more intuitive for assignments?  i said i prefer it, and
>> that's because of aesthetics, silly me.  in an earlier post, someone
>> said it is more natural for his students [1].  argue to the contrary.
>>
>> it depends on how you program, mostly.  if you're doing functional
>> programming with no reassignments, = is just perfect.
>>
>>     
>
> The character string denoting assignment really has no deep importance,
> whether it's = (Fortran, C); := (Algol, Pascal, Ada); <- (R); : (Maxima);
> etc.  However, using the same symbol to denote two quite different things
> which can be meaningful in the same contexts, namely assignment and argument
> naming, strikes me as a poor design decision.
>
>   

you mean foo(x=1) which could be taken both as passing 1 into x or as
assigning 1 to x and passing as the first to foo?  what's poor design is
to even consider the latter in your code.  for reasons you probably know
performing side effects in subexpressions is not a good idea, and if you
have good practices, the poor design decision you mention above is an
artificial problem.

vQ



More information about the R-help mailing list