Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jw3126 committed Dec 12, 2019
1 parent 87d8254 commit 742e9f4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"

[compat]
julia = "1"
MacroTools = "0.5"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,27 @@ This package provides the `@eponym` macro, which infers the name of a keyword ar
from the name of its value. This is best explained by example:
```julia
julia> using EponymKeywordSyntax
julia> a=1; b=2
2

julia> f(args...; kw...) = (args=args, kw=kw)
f (generic function with 1 method)

julia> oh_dear_this_is_long_I_dont_want_to_write_it_twice=3
3
julia> f(oh_dear_this_is_long_I_dont_want_to_write_it_twice=oh_dear_this_is_long_I_dont_want_to_write_it_twice) == @eponym f(;oh_dear_this_is_long_I_dont_want_to_write_it_twice)
true

julia> a=1; b=2;
2

julia> f(a=a, b=b) == @eponym f(;a,b)
true

julia> (a=a, b=b) == @eponym (;a, b)
true

julia> (a=a, b=10) == @eponym (;a, b=10)
true

julia> f(1, a=a, b=b) == @eponym f(1;a, b)
true
```
Expand Down
11 changes: 8 additions & 3 deletions src/EponymKeywordSyntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ from the name of its value. This is best explained by example:
```jldoctest
julia> using EponymKeywordSyntax
julia> a=1; b=2
2
julia> f(args...; kw...) = (args=args, kw=kw)
f (generic function with 1 method)
julia> oh_dear_this_is_long_I_dont_want_to_write_it_twice=3
3
julia> f(oh_dear_this_is_long_I_dont_want_to_write_it_twice=oh_dear_this_is_long_I_dont_want_to_write_it_twice) == @eponym f(;oh_dear_this_is_long_I_dont_want_to_write_it_twice)
true
julia> a=1; b=2;
2
julia> f(a=a, b=b) == @eponym f(;a,b)
true
Expand Down

0 comments on commit 742e9f4

Please sign in to comment.