[Rd] string concatenation operator (revisited)

GILLIBERT, Andre Andre@G||||bert @end|ng |rom chu-rouen@|r
Sun Dec 5 14:56:27 CET 2021


Ivan Krylov <krylov.r00t using gmail.com> wrote:
> FWIW, Perl5 has a separate string concatenation operator (".") in order
> to avoid potential confusion with addition. So do Lua (".."), SQL
> ("||", only some of the dialects) and Raku ("~", former Perl6).


Indeed, using the same operator '+' for addition and string concatenation is not a great idea in my opinion.
Accidental character arguments to a '+' that meant to be a numerical addition would go undetected. Bug tracking would be harder in that case.

R is already too permissive: it finds some interpretation of most probably buggy code, such as ifelse() on vectors of unequal length or '[' operator with only one argument to index a matrix. I would not want to add new permissive behaviors.

A new operator, dedicated to string concatenation, such as %+% or %.%, would be better, in my opinion.

--
Sincerely
Andr� GILLIBERT

	[[alternative HTML version deleted]]



More information about the R-devel mailing list