# @var\_str fails on an example in its documentation

**URL:** <https://discourse.julialang.org/t/var-str-fails-on-an-example-in-its-documentation/111697>\
**Category:** General Usage\
**Created:** [March 16, 2024, 2:54pm UTC](https://discourse.julialang.org/t/var-str-fails-on-an-example-in-its-documentation/111697 "2024-03-16T14:54:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmbates](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmbates/32/44_2.png) [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Post date:** [March 16, 2024, 2:54pm UTC](https://discourse.julialang.org/t/var-str-fails-on-an-example-in-its-documentation/111697/1 "2024-03-16T14:54:39Z")

</div>

```julia
julia> versioninfo()
Julia Version 1.11.0-alpha1
Commit 671de9f5793 (2024-03-01 08:30 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 8 × Apple M1 Pro
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, apple-m1)
Threads: 6 default, 0 interactive, 3 GC (on 6 virtual cores)

help?> @var_str
search:

  var

  The syntax var"#example#" refers to a variable named Symbol("#example#"), even though #example# is not a valid Julia identifier name.

  This can be useful for interoperability with programming languages which have different rules for the construction of valid identifiers. For example, to refer to
  the R variable draw.segments, you can use var"draw.segments" in your Julia code.

  It is also used to show julia source code which has gone through macro hygiene or otherwise contains variable names which can't be parsed normally.

  Note that this syntax requires parser support so it is expanded directly by the parser rather than being implemented as a normal string macro @var_str.

  │ Julia 1.3
  │
  │ This syntax requires at least Julia 1.3.

julia> var"draw.segments"
ERROR: UndefVarError: `draw.segments` not defined in `Main`
Suggestion: check for spelling errors or missing imports.

```

I wanted to check if this behavior is known. I was unable to find an existing issue related to this but searching in git repositories is not a strength for me.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [March 16, 2024, 3:03pm UTC](https://discourse.julialang.org/t/var-str-fails-on-an-example-in-its-documentation/111697/2 "2024-03-16T15:03:18Z")

</div>

I think you misunderstand the error.

```julia
julia> var"draw.segments" = 1
1

julia> var"draw.segments"
1

```

---

<div class="post-metadata">

**Author:** ![dmbates](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmbates/32/44_2.png) [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Post date:** [March 16, 2024, 3:13pm UTC](https://discourse.julialang.org/t/var-str-fails-on-an-example-in-its-documentation/111697/3 "2024-03-16T15:13:52Z")

</div>

You’re correct of course. Thank you.
