Skip to content

Commit 04dbfc8

Browse files
committed
bump & update README
1 parent b7397e2 commit 04dbfc8

File tree

3 files changed

+30
-13
lines changed

3 files changed

+30
-13
lines changed

Project.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
name = "GeneralizedGenerated"
22
uuid = "6b9d7cbe-bcb9-11e9-073f-15a7a543e2eb"
33
authors = ["thautwarm"]
4-
version = "0.2.8"
4+
version = "0.3.0"
55

66
[deps]
7-
CanonicalTraits = "a603d957-0e48-4f86-8fbd-0b7bc66df689"
87
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
98
JuliaVariables = "b14d175d-62b4-44ba-8fb7-3064adc8c3ec"
109
MLStyle = "d8e11817-5142-5d16-987a-aa16d5891078"
1110
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
1211

1312
[compat]
14-
CanonicalTraits = "~0.1, ~0.2"
1513
DataStructures = "0.17, 0.18"
16-
JuliaVariables = "~0.2.1"
17-
MLStyle = "~0.3.1, ~0.4.1"
14+
JuliaVariables = "~0.2.4"
15+
MLStyle = "~0.4.2"
1816
julia = "1"
1917

2018
[extras]

README.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ h(1, 2)(1) # => 14
7676
7777
Note there're some restrictions to the generalized generated functions yet:
7878
79-
- Multiple dispatch is not allowed, and `f(x) = ...` is equivalent to `f = x -> ...`. This will never gets supported for it needs a thorough implementation of multuple dispatch in GG.
79+
- Multiple dispatch is not allowed, and `f(x) = ...` is equivalent to `f = x -> ...`. This will never gets supported for it needs a thorough implementation of multiple dispatch in GG.
8080
- Comprehensions for generated functions are not implemented yet. It won't cost a long time for being supported.
8181
8282
The evaluation module can be specified in this way:
@@ -87,9 +87,10 @@ julia> module S
8787
end
8888
Main.S
8989

90-
julia> @gg m function g(m::Module, y) :(run(y)) end
91-
# the global variable `run` is from the module `m`
92-
g (generic function with 1 method)
90+
julia> @gg g(m::Module, y) = @under_global :m :(run(y));
91+
# the global variable `run` is from the local variable `m`
92+
# <=>
93+
# @gg g(m::Module, y) = :($(:m).run(y));
9394

9495
julia> g(S, 1)
9596
2
@@ -103,12 +104,31 @@ julia> struct S
103104
end
104105
Main.S
105106

106-
julia> @gg m function g(m::S, y) :(run(y)) end
107-
# the global variable `run` is from the datum `m`
108-
g (generic function with 1 method)
107+
julia> @gg function g(m::S, y)
108+
@under_global :m quote
109+
run(y)
110+
end
111+
end;
112+
# <=>
113+
# @gg function g(m::S, y)
114+
# :($(:m).run(y))
115+
# end;
109116

110117
julia> g(S(x -> x + 1), 1)
111118
2
119+
120+
julia> const pseudo_module = S(x -> x + 1);
121+
julia> @gg function g(y)
122+
@under_global pseudo_module quote
123+
run(y)
124+
end
125+
end
126+
# <=>
127+
# @gg function g(y)
128+
# :($(pseudo_module).run(y))
129+
# end
130+
julia> g(1)
131+
2
112132
```
113133
114134
## No `eval`/`invokelatest`!

src/GeneralizedGenerated.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module GeneralizedGenerated
22
using MLStyle
33
using JuliaVariables
4-
using CanonicalTraits
54
using DataStructures
65
List = LinkedList
76

0 commit comments

Comments
 (0)