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

Don't allow editing accumulation variables outside of accumulation commands #83

Closed
okamsn opened this issue Aug 6, 2021 · 1 comment · Fixed by #86
Closed

Don't allow editing accumulation variables outside of accumulation commands #83

okamsn opened this issue Aug 6, 2021 · 1 comment · Fixed by #86
Labels
enhancement New feature or request simplification Making things simpler

Comments

@okamsn
Copy link
Owner

okamsn commented Aug 6, 2021

cl-loop allows this, but iterate does not. Allowing this makes destructured accumulation much slower, which encourages work around rather than using this feature.

It would be better to have the loop be as fast as possible, but that costs flexibility. The question is: Do people actually need to modify accumulation variables outside of loop commands while the loop is running?

User input is needed.

@okamsn okamsn added enhancement New feature or request simplification Making things simpler user input needed Opinion-based changes labels Aug 6, 2021
@okamsn
Copy link
Owner Author

okamsn commented Aug 17, 2021

At this point, I'm definitely leaning towards "no".

As stated above, the current behavior:

  • discourages naming accumulation variables due to the speed penalty
  • discourages using destructuring accumulations, which require named variables
  • encourages using the split flag and knowing more about the macro's internals, just to write (IMO) less readable code

The macro is only useful so long as it is convenient. There are already limitations to how the macro's arguments can be used, and restricting this would change little. Besides, if a user needed to go beyond the accumulation commands, they would probably just use expr in some amount anyway. It is no loss to just use expr fully then.

That being said, it would be nice to add more accumulation commands to lessen the need to go beyond them. E.g., if one can collect at both ends of a list, then one should probably be able to drop at both ends as well.

Disallowing this behavior while adding more accumulation commands should solve this issue, keeping both speed and usefulness.

@okamsn okamsn removed the user input needed Opinion-based changes label Aug 21, 2021
@okamsn okamsn changed the title Should accumulation variables be modifiable outside of commands? Don't allow editing accumulation variables outside of accumulation commands Aug 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request simplification Making things simpler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant