-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use begin block and allow variable export (#50)
- Loading branch information
1 parent
5bfc333
commit aad7f90
Showing
5 changed files
with
120 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# v0.5 | ||
|
||
**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: | ||
|
||
```julia | ||
@chain df begin | ||
transform(...) | ||
select(...) | ||
intermediate = subset(...) | ||
groupby(...) | ||
combine(...) | ||
join(intermediate) | ||
end | ||
|
||
@show intermediate | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aad7f90
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
aad7f90
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/62804
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: