[R] R as a programming language
Duncan Murdoch
murdoch at stats.uwo.ca
Thu Nov 8 19:07:40 CET 2007
On 11/8/2007 12:57 PM, hadley wickham wrote:
>> My objection, at least, was that + should be *associative*. I don't think
>> anyone would expect a + b and b+a to be the same for strings, but I do
>> think the fact that (a+b)+c and a+(b+c) would be different (if some of a,
>> b,c were strings) has real potential for ugliness.
>
> You're assuming an automatic cast from numbers into strings? What if
> a + "4" threw an error?
Disallowing mixed types was one variation on the proposal, but I'd say
that misses the benefit of making computed strings easier to read. If
they're full of "as.character(x)" explicit conversions, they're no
easier to read than paste() (which doesn't need explicit conversions).
Duncan Murdoch
More information about the R-help
mailing list