Open dgr opened 1 week ago
Dave, maybe if we were starting fresh with Etaoin as a new project, this might be interesting.
But today, I don't really see the point.
Do you see a real problem this is solving for users of Etaoin?
Most of the Clojure collections functions produce seqs. This change would decreases the friction since you wouldn't have to convert to vectors all the time. I think it's low risk and non-breaking.
But what pain are you solving for Etaoin users? I've not felt it. Have you explicitly felt it?
No, I have not felt it myself.
So why are we solving a problem no one is having? (any lurkers, please chime in if this would solve a real problem for you).
Problem/Opportunity Today, Etaoin supports a vector as the
q
argument toquery
. This casesquery
to perform a sequence of queries, making a not-necessarily fully contiguous path through the DOM. However, Etaoin doesn't support other sequential data types such as seqs or lists. There's really no reason for this as Etaoin doesn't use those types for other query behavior and in fact converts the vector to a seq internally immediately after testing forvector?
. Further, many Clojure collection processing functions (e.g., filter, map, etc.) return seqs, not vectors, and so if generating the query programmatically, today the programmer has to convert to a vector before passing the query toquery
.Proposed Solution Expand Etaoin's
query
types to allow for anythingsequential?
, giving the same behavior as for vectors today.Additional context
query
throws an exception.query-from-shadow-root-el
function to accept anything that passessequential?
, so if we want to limitquery
to vectors only (today's behavior), I should probably changequery-from-shadow-root-el
to match.Action Either way, I can supply a PR to update accordingly.