Skip to content
Prev 8376 / 63421 Next

behavior of =


        
duncan> On Fri, 8 Nov 2002 08:17:12 -0800 (PST), you wrote:
>> On Fri, 8 Nov 2002, Philippe Grosjean wrote:
>>> foo(a=b)  # Assignment of b to a, and a is passed as first argument to
    >>> function foo()
    >>> foo(a:=b) # b is passed to the named argument 'a' of function foo()
    >>> 
    >> 
    >> Not only would this require rewriting essentially every piece of R code
    >> ever written, but even worse, := is used in other languages (and in the
    >> prehistory of R) as an assignment operator so it would be even less clear
    >> than the current situation.

    duncan> I would say a better change (but not good enough to be worth doing,
    duncan> because it would break so much) would be to drop "=" as an assignment
    duncan> operator, and use ":=" for that purpose.

Why not "<-"  instead of ":="?  I still don't understand why this is
in anyway better (except for pascal and modula programmers, see
Thomas' point from a while back: "If you want those constructs, use
those languages", is application.

best,
-tony