You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# A recursive implementation of getall doesn't actually infer,
41
+
# A straightforward recursive implementation of getall and setall don't actually infer,
42
42
# see https://github.com/JuliaObjects/Accessors.jl/pull/64.
43
-
# Instead, we need to generate unrolled code explicitly.
43
+
# Instead, we need to generate separate functions for each recursion level.
44
+
44
45
functiongetall(obj, optic::ComposedFunction)
45
46
N =length(decompose(optic))
46
47
_getall(obj, optic, Val(N))
@@ -53,20 +54,8 @@ function setall(obj, optic::ComposedFunction, vs)
53
54
end
54
55
55
56
57
+
# _getall: the actual workhorse for getall
56
58
_getall(_, _, ::Val{N}) where {N} =error("Too many chained optics: $N is not supported for now. See also https://github.com/JuliaObjects/Accessors.jl/pull/64.")
57
-
_setall(_, _, _, ::Val{N}) where {N} =error("Too many chained optics: $N is not supported for now. See also https://github.com/JuliaObjects/Accessors.jl/pull/68.")
58
-
59
-
_concat(a::Tuple, b::Tuple) = (a..., b...)
60
-
_concat(a::Tuple, b::AbstractVector) =vcat(collect(a), b)
# takes values as a nested tuple with proper leaf lengths, prepared in setall above
72
+
_setall(_, _, _, ::Val{N}) where {N} =error("Too many chained optics: $N is not supported for now. See also https://github.com/JuliaObjects/Accessors.jl/pull/68.")
0 commit comments