Takafumi Arakaki
Takafumi Arakaki
It's still a big mess right now :) Once it's stabilized, I'll perhaps make a PR to add a section something like "Who uses Setfield.jl" in README and put the...
FYI I wrote `Kaleido.@batchlens` to do this. See: https://github.com/tkf/Kaleido.jl
Is it important that you can do `haslens` or is it OK to have a non-failing lens? As discussed in #65, we can have a lens that returns `Union{Some{T},Nothing}` to...
Oh, it looks useful. It's a bit like [`mergewith`](https://docs.julialang.org/en/v1.6-dev/base/collections/#Base.mergewith)? By the way, why not `val = foldl(f, args)` instead of `val = f(args...)`? (Then it's pretty close to `mergewith`.) Maybe...
FYI, I created something similar called `modifying` and put it DataTools.jl: > ```julia > julia> using DataTools > > julia> map(modifying(a = string), [(a = 1, b = 2), (a...
Here is a super simple implementation without nested assignment support: ```julia using Setfield: set, PropertyLens mutable struct Mutable{T} value::T end thaw(imut) = Mutable(imut) freeze(mut::Mutable) = getfield(mut, :value) Base.setproperty!(mut::Mutable, name::Symbol, value)...
(I used `thaw`/`freeze` (inspired by https://github.com/JuliaLang/julia/pull/31630) instead of `Ref`-like API because it also makes sense to wrap `Tuple`/`NamedTuple`/`StaticArray`/etc. in this API.)
Here is the diff wrt #91 (for easy review): https://github.com/jw3126/Setfield.jl/compare/constbase...colinxs:bangbang
I was assuming that the answer was that "users should be careful." Why not just say that you'd loose the pureness property if there is at least one mutating-lens? That...
> Does this do a constructor call to `A`? Ah, that's a good point. Maybe something like this would work? ```julia function set(obj, l::ComposedLens, val) inner_obj = get(obj, l.outer) if...