Could you please elaborate a little on what â€śissues with aliasingâ€ť means? I sometimes have a long variable name aVeryLongVariableName and it is ugly to write:

That is what I am doing now. But if I want to use it a lot, it seems overkilling to write a package just about map!. And I am not sure if it is type piracy.

I think type stability is the issueâ€”what if you have an array of floats but f returns a string?

I think map! already checks that?

julia> a = [1, 2, 3];
julia> map!(sin, a, a)
ERROR: InexactError: Int64(0.8414709848078965)
Stacktrace:
[1] Int64
@ ./float.jl:788 [inlined]
[2] convert
@ ./number.jl:7 [inlined]
[3] setindex!
@ ./array.jl:966 [inlined]
[4] map!(f::typeof(sin), dest::Vector{Int64}, A::Vector{Int64})
@ Base ./abstractarray.jl:2927
[5] top-level scope
@ REPL[2]:1
julia> map!(string, a, a)
ERROR: MethodError: Cannot `convert` an object of type String to an object of type Int64
Closest candidates are:
convert(::Type{T}, ::Ptr) where T<:Integer at pointer.jl:23
convert(::Type{T}, ::T) where T<:Number at number.jl:6
convert(::Type{T}, ::Number) where T<:Number at number.jl:7
...
Stacktrace:
[1] setindex!(A::Vector{Int64}, x::String, i1::Int64)
@ Base ./array.jl:966
[2] map!(f::typeof(string), dest::Vector{Int64}, A::Vector{Int64})
@ Base ./abstractarray.jl:2927
[3] top-level scope
@ REPL[3]:1

So I just do mapinto!(f, arg) = map!(f, arg, arg).