How to write byte literals in v0.7



Base.CodeUnits seems to wrap it automatically. Is this intended, or a bug? How can I get a Vector{UInt8} using string literals the same way both in v0.6 and v0.7-?

julia> Meta.lower(Main, :(b"123"))
:($(QuoteNode(UInt8[0x31, 0x32, 0x33])))

julia> b"123"
3-element Base.CodeUnits{UInt8,String}:

julia> VERSION


I see that it is actually a DenseVector. Perhaps it is just the manual being out of sync.


See, where this was changed.

Why do you need a Vector{UInt8} specifically? Because you need a mutable array? (Apparently, it was mutable previously but returned the same vector every time, which caused its own problems.)


Nope, I was just dispatching on Vector{UInt8}. Using Compat.jl, I can replace it with DenseVector and have it work in both versions. Thanks!


Note that if you really need DenseVector, you may need to also check stride(A,1) == 1 if you need contiguous memory.