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

Enhance clj->js to resolve lazy sequences #585

Closed
rafaeldelboni opened this issue Nov 28, 2024 · 0 comments
Closed

Enhance clj->js to resolve lazy sequences #585

rafaeldelboni opened this issue Nov 28, 2024 · 0 comments

Comments

@rafaeldelboni
Copy link
Contributor

rafaeldelboni commented Nov 28, 2024

Is your feature request related to a problem? Please describe.
The current implementation of clj->js in Squint does not resolve lazy sequences into normal js sequences. Instead, it appears to be a no-op, leaving the sequence as-is. This can lead to unexpected behavior when using lazy sequences, which are a common pattern in cljs.

For example in cljs:

(clj->js (map inc [1 2 3]))  
; => #js [2 3 4]  

But in Squint, the result does not convert into the expected js array.

Describe the solution you'd like
I’d like clj->js in Squint to behave more like its cljs counterpart by resolving lazy sequences into js arrays. Specifically, calling clj->js on a lazy sequence should fully realize it, ensuring the result is a usable js array.

Describe alternatives you've considered
An alternative would be to explicitly replace clj->js with a vec to realize lists

Additional context
This feature would enhance compatibility with existing cljs codebases and improve the developer experience by making clj->js more intuitive.

borkdude added a commit that referenced this issue Dec 2, 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

No branches or pull requests

1 participant