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

Use begin block and allow variable export #50

Merged
merged 7 commits into from
Jun 21, 2022
Merged

Conversation

jkrumbiegel
Copy link
Owner

Breaking: The @chain macro now creates a begin block, not a let block.
This means that variables that are assigned within the macro are available outside.
Technically, situations are imaginable where this could lead to overwritten variables if someone used large expressions with intermediate variable names in begin blocks spliced into the chain.
It is however quite unlikely for the normal way that @chain is intended to be used.

Additionally, it is now possible to use the syntax variable = some_expression to make use of the feature that variables can be exported.
The some_expression part is handled exactly like before.
This enables you to carry parts of a computation forward to a later step in the chain or outside of it:

@chain df begin
    transform(...)
    select(...)
    intermediate = subset(...)
    groupby(...)
    combine(...)
    join(intermediate)
end

@show intermediate

@jkrumbiegel jkrumbiegel merged commit aad7f90 into master Jun 21, 2022
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

Successfully merging this pull request may close these issues.

1 participant