@var_str fails on an example in its documentation

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.

I think you misunderstand the error.

julia> var"draw.segments" = 1
1

julia> var"draw.segments"
1
1 Like

You’re correct of course. Thank you.