mweststrate / remmi

Nothing to see here. Go away

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rename lens to cursor

milankinen opened this issue · comments

Hi!

Although still being very immature, this project looks interesting. However, I'm a little bit worried about the term "lens" used to describe the derived sub-state view.

The original definition of (functional) lenses provides a first class support for data-independent, composable inspection/manipulation of immutable data structures. Many JS libraries and frameworks such as Ramda, CALMM and Focal are already using this definition as a basis for their implementation. There are also many existing JS related blog posts (e.g this, this and this) using the same definition.

In this project the lenses are not first-class nor composable in sense that they are always bound to specific data object instead of describing the way to inspect/modify it. Actually, this project's "selector functions" seem more like lenses. 😄

Thus I'm opening this issue to discuss the possibility of avoiding the conflict of definitions and reconsidering the name "lens" for sub-state views. For example in Focal and CALMM these derived sub-state views are called lensed atoms and in Reagent they are called cursors and these sub-states are acquired by applying a lens to their parent (exactly like using selector functions in this project).

Yeah, I am still fighting with terminologoy here and there :-). pipes make for a great analogy but collide with functional pipe, views map it nicely back to database terminology, but is so generic. So cursors is probably the best idea indeed :-).