Julia: Rename `join` to `stringjoin` or `joinstring`

Created on 3 Oct 2020  Â·  6Comments  Â·  Source: JuliaLang/julia

On Slack I said:

join is occasionally frustrating because Base defines join for 1 to 3 Any args, so it's hard to extend without giving the user some confusion, and it's a common operation for a varying number of arguments (e.g., join N tables a la SQL)

I think join is not specific enough of a name to describe the operation implemented generically in Base

And @StefanKarpinski suggested opening an issue.

Another issue with join is that since it's extremely generic, it actually does apply to almost every type. So it's conceivable that you might want to join some databases but also separately stringjoin them for printing or something.

A somewhat-related discussion was had here: https://github.com/JuliaLang/julia/issues/26617

deprecation strings

Most helpful comment

join_table seems more doable an approach given that join is used very widely.

All 6 comments

Why don't we start by specifying the types of delim and last arguments?

Is this open to newer contributors? I'd love to take it on! I'll be standing by in case it needs any discussion.

Julia is a very open community, but unfortunately there is only so much we can do about this for now.
If you are interested in this very issue, it may be useful to add a cross-reference to another "word choice" issue.

join_table seems more doable an approach given that join is used very widely.

Other possibility : remove join as a named function, but keep it as an efficient implementation by specializing mapreduce

using Test

# join(strings) = sprint(join, strings) @ julia v1.3
Base.mapreduce(::typeof(string), op, strings::AbstractArray) = sprint(op, strings)

@test mapreduce(string, join, [1:3...]) == "123"
@test mapreduce(string, (io,s)->join(io,s,";"), [1:3...]) == "1;2;3"
Was this page helpful?
0 / 5 - 0 ratings

Related issues

StefanKarpinski picture StefanKarpinski  Â·  3Comments

tkoolen picture tkoolen  Â·  3Comments

ararslan picture ararslan  Â·  3Comments

Keno picture Keno  Â·  3Comments

dpsanders picture dpsanders  Â·  3Comments