Closed ghost closed 7 years ago
Hi @sj4
The idea is very nice, but I'm not so sure if I want this on the core, I need some time to think about this. It seems that it is very easy to do on client side and in general, it looks a little bit opinionated maybe?
Give me some days for think about that and how it can impact on the library usage :D and thanks for the idea!
let's keep it pure
Libraries such as reagent and freactive come with built-in support for cursors, e.g. (cursor a [:a :b]) vs. (l/derive (l/in [:a :b]) a)
Since lenses are even more generic, it is possible to create a cursor-like abstraction with lentes, by implementing IIndexed and ILookup in RWFocus
Since a is not dereferenced, this will return a new lentes (RW)-focus,
This is even better than the cursors in e.g. reagent :) - it makes code very readable, because it allows the usage of 'get' 'nth' 'get-in' etc. instead of introducing a new 'cursor' function
see also this commit for an example: https://github.com/sj4/todomvc/commit/3a3690f67c46d8bff11d813f0cf5f9f246c7c97b Thanks in advance for considering