summary refs log tree commit diff stats
path: root/compiler/modules.nim
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2018-04-18 19:40:08 +0300
committerAndreas Rumpf <rumpf_a@web.de>2018-05-07 09:37:49 +0200
commitbdcb72959729a5c4b195f9bf6b2ac8783c27f38e (patch)
treeb0ba8988e45410d1e869b7af35e30bfe57d236f3 /compiler/modules.nim
parent7897026e575a4abd44583cd453b8d36cac96327e (diff)
downloadNim-bdcb72959729a5c4b195f9bf6b2ac8783c27f38e.tar.gz
Better support for treating templates and macros as symbols.
This allows you to pass a template or a macro to another macro
which can then inspect the implementation of the former template/macro
using `getImpl`.

Since templates can be freely redefined, this allows you to treat
their symbols as compile-time variables that have lexical scope.
A motivating PoC example for a logging library taking advantage of
this will be provided in the next commit.

Implementation details:

* The name of a template or a macro will be consider a symbol if
  the template/macro requires parameters

* For parameterless templates/macros, you can use `bindSym`, which
  was extended to also work outside of compile-time procs.
Diffstat (limited to 'compiler/modules.nim')
0 files changed, 0 insertions, 0 deletions
Kartik K. Agaram <vc@akkartik.com> 2016-11-06 01:32:01 -0800 committer Kartik K. Agaram <vc@akkartik.com> 2016-11-06 01:32:01 -0800 3636' href='/akkartik/mu/commit/001help.cc?h=main&id=7cca315fb435234adae3c46c65594feccb9d1fbd'>7cca315f ^
78e3f553 ^







2c678a4e ^


8359e579 ^


8f249677 ^
78e3f553 ^

b39ceb27 ^



78e3f553 ^










6c96a437 ^
78e3f553 ^

56ce5577 ^






8f97725d ^
6a9d8191 ^
b39ceb27 ^




d4030624 ^
ae08e30e ^
6c96a437 ^
ae08e30e ^

d4030624 ^

5a702544 ^















































863f52e8 ^

b24eb476 ^
863f52e8 ^




ac0e9db5 ^
b24eb476 ^
c58e2368 ^
23679883 ^
5b5ef63b ^

6573fe1f ^
5b5ef63b ^






df37108f ^
5b5ef63b ^



5b5ef63b ^
1a33d221 ^
5b5ef63b ^


c1a46edf ^
5b5ef63b ^








5b5ef63b ^





c58e2368 ^
5a6645bc ^
6573fe1f ^
5a6645bc ^



74262581 ^

5a6645bc ^






f603d9f2 ^
5a6645bc ^





f603d9f2 ^
5a6645bc ^



795f5244 ^







91abd257 ^




795f5244 ^
87374384 ^


795f5244 ^
f3760b0f ^







c58e2368 ^
08cf048f ^


c58e2368 ^
08cf048f ^


ac0e9db5 ^
b39ceb27 ^
385ff136 ^
d98e1a18 ^
385ff136 ^
b39ceb27 ^





385ff136 ^
b39ceb27 ^
10f415a6 ^
385ff136 ^
b39ceb27 ^
fd72ec75 ^
514f0e34 ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264