JuliaStaging / JuliaStaging/GeneralizedGenerated.jl
Allow statically typed variables
- Dominant language
- Julia
- Stars
- 89
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
The Julia docs recommend that in some cases, variables can be type-annotated (LHS, not RHS). The section
https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-captured
says,
> If captured variables are used in a performance-critical section of the code, then the following tips help ensure that their use is performant. First, if it is known that a captured variable does not change its type, then this can be declared explicitly with a type annotation (on the variable, not the right-hand side):
```julia
function abmult2(r0::Int)
r::Int = r0
if r < 0
r = -r
end
f = x -> x * r
return f
end
```
Annotations like `r::Int = r0` sometimes lead to problems if GG also decides to box that variable. Could a type declaration like this be taken by GG as an assertion that the variable is unboxed?
This is related to https://github.com/cscherrer/Soss.jl/issues/337
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.