Skip to content

Commit 993b03f

Browse files
committed
add comment
1 parent c3b135c commit 993b03f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/optics.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ function (l::PropertyLens{field})(obj) where {field}
398398
getproperty(obj, field)
399399
end
400400

401+
# Julia seems to prefers if types stay in the type domain the whole time like NamedTuple{(field,)}, instead of going through the value domain and constprop like (; field => val)
401402
@inline set(obj, l::PropertyLens{field}, val) where {field} = setproperties(obj, NamedTuple{(field,)}((val,)))
402403
@inline delete(obj::NamedTuple, l::PropertyLens{field}) where {field} = Base.structdiff(obj, NamedTuple{(field,)})
403404
@inline insert(obj::NamedTuple{KS}, l::PropertyLens{field}, val) where {KS, field} = NamedTuple{(KS..., field)}((values(obj)..., val))

0 commit comments

Comments
 (0)