https://pantsbuild.org/ logo
w

witty-crayon-22786

01/03/2019, 12:07 AM
@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

aloof-angle-91616

01/03/2019, 12:08 AM
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

witty-crayon-22786

01/03/2019, 12:09 AM
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

aloof-angle-91616

01/03/2019, 12:10 AM
i thought that was daniel's suggestion
w

witty-crayon-22786

01/03/2019, 12:10 AM
take another look i think...it's subtle
a

aloof-angle-91616

01/03/2019, 12:10 AM
just disallowing yields without assignment except at the end of a statement body is clear i think
w

witty-crayon-22786

01/03/2019, 12:11 AM
right.
a

aloof-angle-91616

01/03/2019, 12:11 AM
that's what i wanted and i was just trying to satisfy the populace who seemed to consider it less pythonic
w

witty-crayon-22786

01/03/2019, 12:12 AM
well, his comment points out that there are valid cases for a LHSless yield in other places
(doing an early return, basically)
a

aloof-angle-91616

01/03/2019, 12:13 AM
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

witty-crayon-22786

01/03/2019, 12:14 AM
ah. and by "end of a series of statements", you mean either a nested block or the method body itself
a

aloof-angle-91616

01/03/2019, 12:14 AM
correct
w

witty-crayon-22786

01/03/2019, 12:14 AM
k
a

aloof-angle-91616

01/03/2019, 12:15 AM
"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

witty-crayon-22786

01/03/2019, 12:16 AM
well, this might be a reason to do it the way daniel was suggesting... *shrug
a

aloof-angle-91616

01/03/2019, 12:16 AM
oh that's not an issue
it's just a question
w

witty-crayon-22786

01/03/2019, 12:16 AM
k
a

aloof-angle-91616

01/03/2019, 12:18 AM
i think i got it
will push to a new PR
w

witty-crayon-22786

01/03/2019, 12:18 AM
thanks!
a

aloof-angle-91616

01/03/2019, 12:18 AM
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
2 Views