# How to write byte literals in v0.7

**URL:** <https://discourse.julialang.org/t/how-to-write-byte-literals-in-v0-7/8455>\
**Category:** Internals & Design\
**Tags:** question\
**Created:** [January 18, 2018, 1:00pm UTC](https://discourse.julialang.org/t/how-to-write-byte-literals-in-v0-7/8455 "2018-01-18T13:00:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 18, 2018, 1:00pm UTC](https://discourse.julialang.org/t/how-to-write-byte-literals-in-v0-7/8455/1 "2018-01-18T13:00:33Z")

</div>

`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
julia> Meta.lower(Main, :(b"123"))
:($(QuoteNode(UInt8[0x31, 0x32, 0x33])))

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

julia> VERSION
v"0.7.0-DEV.3385"

```

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 18, 2018, 1:28pm UTC](https://discourse.julialang.org/t/how-to-write-byte-literals-in-v0-7/8455/2 "2018-01-18T13:28:05Z")

</div>

I see that it is actually a `DenseVector`. Perhaps it is just the [manual](https://docs.julialang.org/en/latest/manual/strings/#man-byte-array-literals-1) being out of sync.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 18, 2018, 1:34pm UTC](https://discourse.julialang.org/t/how-to-write-byte-literals-in-v0-7/8455/3 "2018-01-18T13:34:20Z")

</div>

See [https://github.com/JuliaLang/julia/pull/25373](https://github.com/JuliaLang/julia/pull/25373), 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.)

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 18, 2018, 1:35pm UTC](https://discourse.julialang.org/t/how-to-write-byte-literals-in-v0-7/8455/4 "2018-01-18T13:35:12Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 18, 2018, 1:46pm UTC](https://discourse.julialang.org/t/how-to-write-byte-literals-in-v0-7/8455/5 "2018-01-18T13:46:52Z")

</div>

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