-
Notifications
You must be signed in to change notification settings - Fork 9
Description
While working on VarNamedTuple, I'm running into situations where I wish we owned the IndexLens and PropertyLens types. The problem is that Accessors is all about immutable operations, and the lenses don't play nicely with BangBang, but rather assume that all getting and setting happens through Accessors.get/set. For instance, I would like to define this method:
BangBang.setindex!!(arr::AbstractArray, value, lens::IndexLens)
return BangBang.setindex!!(arr, value, lens.indices...)
endbut that's type piracy.
I don't see much that would be lost if we dropped the Accessors dependency and instead implemented our own PropertyLens and IndexLens. As far as I can see, we don't use most of the machinery that Accessors brings, with its get, set, update, and delete functions. We might lose things like Accessors.set((; a=1), @varname(a), 2), but I don't see us using them.
An extra benefit would be that we could normalise lenses when the composed lens is created, not only when it's created within a VarInfo, which might make it more robust.
I'm not proposing doing this immediately, but I'm interested to hear if anyone sees strong reasons to not do this, in case I conclude that this would massively help my life with VarNamedTuple.
Related: #127