Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support sequentials in addition to vectors for query #671

Closed
dgr opened this issue Sep 16, 2024 · 6 comments
Closed

Support sequentials in addition to vectors for query #671

dgr opened this issue Sep 16, 2024 · 6 comments

Comments

@dgr
Copy link
Contributor

dgr commented Sep 16, 2024

Problem/Opportunity
Today, Etaoin supports a vector as the q argument to query. This cases query 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 for vector?. 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 to query.

Proposed Solution
Expand Etaoin's query types to allow for anything sequential?, giving the same behavior as for vectors today.

Additional context

  1. This would not be a breaking change since it liberalizes what Etaoin accepts. Today, if provided with a non-vector sequential, query throws an exception.
  2. I previously wrote the query-from-shadow-root-el function to accept anything that passes sequential?, so if we want to limit query to vectors only (today's behavior), I should probably change query-from-shadow-root-el to match.

Action
Either way, I can supply a PR to update accordingly.

@dgr dgr changed the title Support sequential in addition to vectors Support sequentials in addition to vectors Sep 16, 2024
@dgr dgr changed the title Support sequentials in addition to vectors Support sequentials in addition to vectors for query Sep 16, 2024
@lread
Copy link
Collaborator

lread commented Sep 16, 2024

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?

@dgr
Copy link
Contributor Author

dgr commented Sep 16, 2024

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.

@lread
Copy link
Collaborator

lread commented Sep 16, 2024

But what pain are you solving for Etaoin users? I've not felt it.
Have you explicitly felt it?

@dgr
Copy link
Contributor Author

dgr commented Sep 16, 2024

No, I have not felt it myself.

@lread
Copy link
Collaborator

lread commented Sep 16, 2024

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).

@dgr dgr mentioned this issue Sep 23, 2024
4 tasks
@lread
Copy link
Collaborator

lread commented Oct 18, 2024

Gonna go ahead and close this one.

@lread lread closed this as not planned Won't fix, can't repro, duplicate, stale Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants