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

Consider reimplementing dotimes without loop #298

Closed
brunchboy opened this issue Apr 2, 2020 · 2 comments
Closed

Consider reimplementing dotimes without loop #298

brunchboy opened this issue Apr 2, 2020 · 2 comments
Labels
clj-together enhancement New feature or request

Comments

@brunchboy
Copy link

Is your feature request related to a problem? Please describe.
I’m running sci with the :termination-safe preset, and my users wanted to be able to use dotimes for a finite loop, but this fails because it delegates to the forbidden loop. It’s possible to manually rewrite such code using doseq and range, but we could save people the surprise and effort.

Describe the solution you'd like
I was thinking we could simply provide an alternate implementation of dotimes which was implemented without loop, probably with doseq and range to avoid this issue.

Describe alternatives you've considered
As described above, we can simply have users do it themselves.

Additional context
I brought this idea up on the babashka channel of the clojurians slack, and Michiel agreed that it might be a useful enhancement. He suggested looking at the history of the macro .cljc file to see how a similar fix had already been made to for. A quick scan suggests it might be #141

This is an interesting problem so I may try my hand at a PR, but want to capture the issue first anyway, because given all the issues I am working on in my own projects, it might not be realistic that I will get around to working on this.

@borkdude
Copy link
Collaborator

borkdude commented Apr 3, 2020

@brunchboy I think the same fix that we applied for the for macro can also be applied to dotimes:

cf8db77#diff-5a9a05f99b4c6e1b37f7f89cff8b3681

@borkdude borkdude added this to To do in Clojurists Together via automation Apr 3, 2020
@borkdude borkdude added the enhancement New feature or request label Apr 3, 2020
borkdude added a commit that referenced this issue Apr 3, 2020
@borkdude
Copy link
Collaborator

borkdude commented Apr 3, 2020

Fixed with bce604b

@borkdude borkdude closed this as completed Apr 3, 2020
Clojurists Together automation moved this from To do to Done Apr 3, 2020
@borkdude borkdude removed this from Done in Clojurists Together May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clj-together enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants