The strangeness (or not) of * as string concatenation

I imagine you may well be thinking of the (dormant, but not forgotten/abandoned) thread Designing a Paths Julep, but in case you or any interested readers have forgotten, that’s exactly what I’m proposing there :slight_smile:

Another upside of this sort of approach is that based on whether a $string or $path is being interpolated, you can catch and handle unsafe input like:

# from reading config/user input/etc.
untrusted_file = "../../../../../../etc/passwd"
read_path = path"user_content/$untrusted_file"
                            # ^ interpolation error thrown

Eh, IEEE floats may muddy the waters, but + is the Abelian group operator. Just because it’s not perfectly adhered to is no reason to abandon convention.

That said, I do see the confusion around *, and I think there’s a solid argument that instead of picking between punning addition/multiplication it would be sensible to dedicate an operator to the concatenation of containery-types (vectors, strings, etc.) like ++. Until Julia 2.0 though, we’ll just have to live with the status quo, and this niggle is fairly low my list of breaking changes I wish we could make.

4 Likes