From rossini@u.washington.edu  Fri Nov  8 16:41:57 2002
From: rossini@u.washington.edu (A.J. Rossini)
Date: 08 Nov 2002 08:41:57 -0800
Subject: behavior of =
In-Reply-To: <MABBLJDICACNFOLGIHJOOEKIDAAA.phgrosje@ulb.ac.be>
References: <MABBLJDICACNFOLGIHJOOEKIDAAA.phgrosje@ulb.ac.be>
Message-ID: <87lm44814a.fsf@jeeves.blindglobe.net>

>>>>> "philippe" == Philippe Grosjean <phgrosje@ulb.ac.be> writes:

    philippe> Deprecating '_' for assignment in the perspective of reusing it in variables
    philippe> names is nice (not just a personal impression bacause it is also common in
    philippe> other languages). I am fighting too often with unreadable codes like
    philippe> var_value, even without spaces before and after '_'!!!
    philippe> Addition of '=' for assignment is nice too (also commonly used in other
    philippe> languages), except for this problem with named arguments...! I know this is
    philippe> a major change that would require patching all R code, but perhaps a
    philippe> solution would be to replace '=' in named arguments with something else,...
    philippe> ('_'  for instance.. no, I am kidding!). But perhaps, ':=' would be a nice
    philippe> candidate. So:

    philippe> foo(a=b)  # Assignment of b to a, and a is passed as first argument to
    philippe> function foo()
    philippe> foo(a:=b) # b is passed to the named argument 'a' of function foo()

No, no, no.

While I can see depreciating "_" as assignment, I would seriously
worry about reusing it in variable names, breaking old code and all of
that.  Currently, we've got "."  for separation if you need it.
Sure, other languages use it for methods, and in a sense, so does S3
classes, but it's what you are given.

The "<-" assignment operator is beautiful.  It's taken me over a
decade, but I have come to appreciate it.  It isn't common, and there
are fewer and fewer ex-APL'ers, but I think it's a great choice.

The use of "=" for named arguments in a function call signature makes
sense, and the use of "==" for equality makes sense.

But syntactical sugar should only be messed with if broken (and yes,
this may be one of the few points that I'd disagree with John; I wish
he'd never introduced "=" as a possible assignment).

best,
-tony

-- 
A.J. Rossini				Rsrch. Asst. Prof. of Biostatistics
U. of Washington Biostatistics		rossini@u.washington.edu	
FHCRC/SCHARP/HIV Vaccine Trials Net	rossini@scharp.org
-------------- http://software.biostat.washington.edu/ ----------------
FHCRC: M: 206-667-7025 (fax=4812)|Voicemail is pretty sketchy/use Email
UW:   Th: 206-543-1044 (fax=3286)|Change last 4 digits of phone to FAX
(my tuesday/wednesday/friday locations are completely unpredictable.)



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


behavior of =
A.J. Rossini