JuliaStaging / JuliaStaging/GeneralizedGenerated.jl

More complex cases will fail

Open
#20 1 comment 0 reactions 0 assignees View on GitHub
bug help wanted question
Dominant language
Julia
Stars
89
Forks
12
PR merge metrics
No merged PRs in 30d

Description

Some known cases and **workaround**:

## When a let binding LHS symbol is a denoting mutable shared variable.
```julia
@gg test() = quote
function (x)
let x = x
y -> begin
x = x + 1
x
end
end
end
end
```
**workaround**: currently, do not mutate a free variable, or box it in `Ref` or `Core.Box`:

```julia
@gg test() = quote
function (x)
let x = Ref(x)
y -> begin
x[] = x[] + 1
end
end
end
end
```

## Generators

```julia
@gg test() = quote
seq -> :(x+1 for x in seq)
end
```

**workaround**: do not use generator syntax, try to abstract it outside:

```julia
@inline gen(seq) = (x + 1 for x in seq)
@gg test() = quote
gen(seq)
end
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.