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

@aside cuts the chain if the last statement #32

Closed
pfarndt opened this issue Jul 15, 2021 · 2 comments
Closed

@aside cuts the chain if the last statement #32

pfarndt opened this issue Jul 15, 2021 · 2 comments

Comments

@pfarndt
Copy link

pfarndt commented Jul 15, 2021

If @aside is the last last statement in a chain then it is cut. Consider:

using DataFrames, DataFramesMeta (v0.8.0)

df = @chain DataFrame(a = 1:4) begin
    @aside println(nrow(_))
end

This just prints out 4 and assigns nothing to df. This is unexpected and unfortunate because one sometimes wants to know how many rows are left (or something similar) after some data crunching steps.

A possible (but unattractive) workaround is to place an identity in the last line:

df = @chain DataFrame(a = 1:4) begin
    @aside println(nrow(_))
    identity
end

This now assigns df to be the expected 4 row DataFrame.

@jkrumbiegel
Copy link
Owner

Ah yeah I knew about this but didn't have time to fix it. I just need to repeat the last temp variable if the last statement is an @aside one

@jkrumbiegel
Copy link
Owner

fixed here e89262b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants