Drop optimization to avoid intermediate variable in some cases #223
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See also #204.
Needing to know the exact behavior of each command to remember whether it
behaves differently is too much of a burden to be practical. If one were to add
an
iter-opt
special macro argument, that would only move the burden to needingto remember when to use
iter-opt
.As mention in #204, using
iter-opt
requires the user to:all for a slight gain in speed and marginally less typing.
For those reasons, instead of adding
iter-opt
, it is better to remove thesefew optimized behaviors in favor of more standard behavior. As noted in #204,
instead of writing
one could instead write
which is basically the same length while requiring less knowledge of each
optimized iteration command's internals.
There are already cases where Loopy is not hyper-optimized, such as explicit
accumulation variables. However, there, the behavior of
accum-opt
is muchless of a burden to remember, because it affects every accumulation command
in the same way. There are no special cases to remember.
For these optimizations, it is the case that Loopy's flexibility and consistency has a small cost, but they are not the only case of that (consider how
cl-loop
moves some variable setting toand
expressions while we settle forcatch
andthrow
) and we do not question the value of consistency and predictability in those cases.