<@U6ZRNH0TC>: sorry for the miscommunication on <h...
# general
w
@aloof-angle-91616: sorry for the miscommunication on https://github.com/pantsbuild/pants/pull/7015 ... i wasn't reading as closely as i should have.
a
neither was i -- very little work was lost and i 3000% agree that a single
yield
is better and wasn't making clear the progress of everything
w
the difference between
yield Get(...)
and
yield AnythingElse
is key
i missed that you were suggesting requiring a
return
for all LHSless yields. and Daniel's suggestion was something else
sorry about that.
a
i thought that was daniel's suggestion
w
take another look i think...it's subtle
a
just disallowing yields without assignment except at the end of a statement body is clear i think
w
right.
a
that's what i wanted and i was just trying to satisfy the populace who seemed to consider it less pythonic
w
well, his comment points out that there are valid cases for a LHSless yield in other places
(doing an early return, basically)
a
yes
the error message i'm adding says
Copy code
A yield in an @rule without an assignment is equivalent to a return, and we
currently require that it comes at the end of a series of statements.
Use `_ = yield Get(...)` if you wish to yield control to the engine and discard the result.
w
ah. and by "end of a series of statements", you mean either a nested block or the method body itself
a
correct
w
k
a
"luckily" this always comes in the form of the
body
or
orelse
attrs
modulo a
finally
block which i was about to add a comment for
would we want to allow returning in a
finally
? i guess that's allowed
ok so that too
w
well, this might be a reason to do it the way daniel was suggesting... *shrug
a
oh that's not an issue
it's just a question
w
k
a
i think i got it
will push to a new PR
w
thanks!
a
i should have done that immediately once i realized it was orthogonal work
i also found a 3rdparty lib that does the necessary line/col offset bookkeeping to make error messages much better and will push a diff after the above passes ci
hm. it appears i accidentally pushed it to the same branch
reverting that now