Skip to content

Quasiquotation in for outer $var... expressions does not work #37393

@jamesrhester

Description

@jamesrhester

Julia appears not to recognise for outer constructions in Expressions when performing substitution. This has been tested using Julia 1.2 and 1.5.1.

The following snippet without outer works as expected, substituting the value :p into the for loop:

julia> g() = begin
       q = :p
       :(for $q = 1:2:3 end)
       end
g (generic function with 1 method)

julia> g()
:(for p = 1:2:3
  end)

However, when outer is added the variable substitution is not recognised:

julia> f() = begin
       q = :p
       :(for outer $q = 1:2:3 end)
       end
f (generic function with 1 method)

julia> f()
:(for outer $ q = 1:2:3
  end)

Julia version info:

Julia Version 1.5.1
Commit 697e782ab8 (2020-08-25 20:08 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, broadwell)
Environment:
  JULIA_PATH = /usr/local/julia
  JULIA_GPG = 3673DF529D9049477F76B37566E3C7DC03D6E495
  JULIA_VERSION = 1.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    parserLanguage parsing and surface syntax

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions