Broadcasting string interpolation

Currently, this does not work:

julia> is = [1,2]
2-element Vector{Int64}:
 1
 2

julia> "$.is"  # currently a syntax error
2-element Vector{String}:
 "1"
 "2"

But it should, right? For completeness sake?
Allowing $. as a broadcasting operation should be non-breaking since "$." is invalid.

It would make type-inference slightly more involved, since "..." can now also be an array of strings.

I don’t think that should work, no. You are interpolating into a single string, it should return only a single string.

$ interpolation is just syntactic sugar for calling string, e.g. "foo $x" is equivalent to string("foo ", x), so you can broadcast string.(...) if you want.

5 Likes