Hi Joshua,
On 06/17/2015 11:24 AM, Joshua Bradley wrote:
How would this new '+' deal with factors, as paste does or as the current
'+'
does? Would number+string and string+number cause errors (as in current
'+' in R and python) or coerce both to strings (as in current R:paste and
in perl's '+').
I had posted this sample code previously to demonstrate how string
concatenation could be implemented
"+" = function(x,y) {
if(is.character(x) & is.character(y)) {
return(paste0(x , y))
} else {
.Primitive("+")(x,y)
}}
so it would only happen if both objects were characters,
Problem with this is that it's inconsistent with other binary operators
that will first coerce the non-character operand to character if the
other operand is a character.
H.
otherwise you
should expect the same behavior as before with all other classes. This
would be backwards compatible as well since string+string was never
supported before and therefore no one would have previously working code
that could break.
Josh Bradley
[[alternative HTML version deleted]]
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
--
Hervé Pagès
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024
E-mail: hpa...@fredhutch.org
Phone: (206) 667-5791
Fax: (206) 667-1319
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel