jw3126 / Setfield.jl

Update deeply nested immutable structs.
Other
167 stars 17 forks source link

Return type-less constructor from constructor_of #19

Closed tkf closed 6 years ago

tkf commented 6 years ago

suggestion for #17; extending #18

codecov-io commented 6 years ago

Codecov Report

Merging #19 into settable will increase coverage by 0.02%. The diff coverage is 89.74%.

Impacted file tree graph

@@             Coverage Diff             @@
##           settable     #19      +/-   ##
===========================================
+ Coverage     86.47%   86.5%   +0.02%     
===========================================
  Files             5       5              
  Lines           170     200      +30     
===========================================
+ Hits            147     173      +26     
- Misses           23      27       +4
Impacted Files Coverage Δ
src/lens.jl 83.33% <50%> (-1.58%) :arrow_down:
src/settable.jl 93.02% <91.89%> (+0.16%) :arrow_up:
src/macrotools.jl 81.39% <0%> (-2.33%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a92564e...5c8325c. Read the comment docs.

jw3126 commented 6 years ago

A case that worked out of the box before, but does not work out of the box anymore is:

struct S{A,B}
    a::A
end

s = S{Int, :B}(1)
@set s.a = 2

But I think having your differentiation example work out of the box is absolutely worth it. Can you remove now unnecessary constructor_of from the tests? Edit: I realize there is no such case. Can you then add a test, where the type is changed with @set, but there is no explicit constructor_of defined.

tkf commented 6 years ago

Closing, since #18 now includes this branch.