You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added a table comparing rewrite-clj v0, v1 and rewrite-cljs
behaviours.
General:
- bullet point capitalizations now consistent
- fix any typos I noticed
- reordered a few bullets
Closes#137
* moved from potemkin import-vars to static template based version https://github.com/clj-commons/rewrite-clj/issues/98[#98]:
76
-
** avoids frustration/mysteries of dynamic import-vars for users and maintainers
77
-
** argument names now correct in API docs (some were gensymed previously)
78
-
** line numbers for protocols in API docs are now correct
79
-
** also turfed use of custom version of potemkin defprotocol+ in favor of plain old defprotocol. Perhaps I missed something, but I did not see the benefit of defprotocol+ for rewrite-clj v1.
75
+
* Moved from potemkin import-vars to static template based version https://github.com/clj-commons/rewrite-clj/issues/98[#98]:
76
+
** Avoids frustration/mysteries of dynamic import-vars for users and maintainers
77
+
** Argument names now correct in API docs (some were gensymed previously)
78
+
** Line numbers for protocols in API docs are now correct
79
+
** Also turfed use of custom version of potemkin defprotocol+ in favor of plain old defprotocol. Perhaps I missed something, but I did not see the benefit of defprotocol+ for rewrite-clj v1.
80
80
81
81
==== Internal changes (developer facing)
82
82
* Tests updated to hit public APIs https://github.com/clj-commons/rewrite-clj/issues/106[#106]
@@ -114,18 +114,140 @@ Rewrite-cljs users migrating to rewrite-clj v1 are now at, and will remain at, f
114
114
115
115
==== Unreleased Breaking Changes
116
116
117
-
* minimum Clojure version bumped from v1.5.1 to v1.9
118
-
* minimum ClojureScript version (from whatever is was for rewrite-cljs) bumped to v1.10
119
-
* minimum Java version bumped from v7 to v8
120
-
* keyword node field `namespaced?` renamed to `auto-resolved?`
121
-
* namespaced map support reworked
122
-
** prefix is now stored in a namespaced map qualifier node, was formerly stored as a keyword
123
-
* namespaced element sexpr support now relies on auto-resolver to resolve qualifiers
124
-
** unlike rewrite-clj v0, the default auto-resolver never consult `*ns*`
125
-
** an sexpr for keyword node `::alias/foo` no longer returns `:alias/foo` (this could be consider a bug fix, but if you were expecting this, then you'll need to make changes)
117
+
* Minimum Clojure version bumped from v1.5.1 to v1.9
118
+
* Minimum ClojureScript version (from whatever is was for rewrite-cljs) bumped to v1.10
119
+
* Minimum Java version bumped from v7 to v8
120
+
* Keyword node field `namespaced?` renamed to `auto-resolved?`
126
121
* Now using `ex-info` for explicitly raised exceptions
127
-
* rewrite-cljs positional support migrated to rewrite-clj's positional support
128
-
122
+
* Rewrite-cljs positional support migrated to rewrite-clj's positional support
123
+
* Namespaced element support reworked
124
+
** Namespace map prefix, is now stored in a namespaced map qualifier node.
125
+
Prior to v1, was stored as a keyword.
126
+
** Namespaced element sexpr support now relies on user specifiable auto-resolve function to resolve qualifiers
127
+
** Unlike rewrite-clj v0, the default auto-resolve behaviour never consults `\*ns*`
128
+
** An sexpr for keyword node `::alias/foo` no longer returns `:alias/foo` (this could be considered a bug fix, but if your code is expecting this, then you'll need to make changes)
129
+
** The following namespaced element `sexpr` examples assume:
130
+
*** `\*ns*` is bound to `user` namespace (important only for rewrite-clj v0):
131
+
*** We are using the default auto-resolve function for rewrite-clj v1
132
+
*** That you will refer to the link:01-user-guide.adoc#namespaced-elements[User Guide] for more detailed examples of v1 behaviour
133
+
+
134
+
[%header,cols="19,27,27,27"]
135
+
|===
136
+
| source
137
+
| sexpr rewrite-clj v1
138
+
| sexpr rewrite-clj v0
139
+
| sexpr rewrite-cljs
140
+
141
+
| qualified keyword +
142
+
`:prefix/foo`
143
+
3+| no change
144
+
145
+
| current-ns qualified keyword +
146
+
`::foo`
147
+
| `:?\_current-ns_?/foo`
148
+
| `:user/foo`
149
+
a| * throws on sexpr
150
+
151
+
| ns-alias qualified keyword +
152
+
`::alias/foo`
153
+
| `:??\_alias_??/foo`
154
+
| `:alias/foo`
155
+
| `:alias/foo`
156
+
157
+
| qualified map +
158
+
`#:prefix{:a 1}`
159
+
| `#:prefix{:a 1}`
160
+
| `#:prefix{:a 1}`
161
+
| `(read-string "#:prefix{:a 1}")`
162
+
163
+
| current-ns qualified map +
164
+
`#::{:b 2}`
165
+
| `#:?\_current-ns_?{:b 2}`
166
+
a| * throws on parse
167
+
a| * throws on parse
168
+
169
+
| ns-alias qualified map +
170
+
`::alias{:c 3}`
171
+
| `#:??\_alias_??{:c 3}`
172
+
a| * throws unless namespace alias `alias` has been loaded in `\*ns*`
173
+
* if `alias` in `*ns*` resolves to `my.ns1`: +
174
+
`#:my.ns1{:c 3}`
175
+
| `(read-string "#::alias{:c 3}")`
176
+
177
+
|===
178
+
179
+
*** Let's dig into prefix and key sub-nodes of a namespaced map to explore v1 differences:
180
+
+
181
+
[cols="40,30,30"]
182
+
|===
183
+
| Description | rewrite-clj v1 | rewrite-clj v0 and rewrite-cljs
184
+
185
+
3+a| prefix (aka qualifier)
186
+
187
+
a|qualified
188
+
[source,clojure]
189
+
----
190
+
(-> "#:prefix{:a 1}"
191
+
z/of-string
192
+
z/down z/sexpr)
193
+
----
194
+
| `prefix`
195
+
| `:prefix`
196
+
197
+
a| current-ns qualified
198
+
[source,clojure]
199
+
----
200
+
(-> "#::{:b 2}"
201
+
z/of-string
202
+
z/down z/sexpr)
203
+
----
204
+
| `?\_current-ns_?`
205
+
a| * throws on parse
206
+
207
+
a| ns-alias qualified
208
+
[source,clojure]
209
+
----
210
+
(-> "#::alias{:c 2}"
211
+
z/of-string
212
+
z/down z/sexpr)
213
+
----
214
+
a| `??\_alias_??`
215
+
a| `:user/alias`
216
+
217
+
* rewrite-cljs throws
218
+
219
+
3+a| key
220
+
a| qualified
221
+
[source,clojure]
222
+
----
223
+
(-> "#:prefix{:a 1}"
224
+
z/of-string
225
+
z/down z/right z/down z/sexpr)
226
+
----
227
+
| `:prefix/a`
228
+
| `:a`
229
+
230
+
a| current-ns qualified
231
+
[source,clojure]
232
+
----
233
+
(-> "#::{:b 2}"
234
+
z/of-string
235
+
z/down z/right z/down z/sexpr)
236
+
----
237
+
|`:?_current-ns_?/b`
238
+
a| * throws on parse
239
+
240
+
a| ns-alias qualified
241
+
[source,clojure]
242
+
----
243
+
(-> "#::alias{:c 3}"
244
+
z/of-string
245
+
z/down z/right z/down z/sexpr)
246
+
----
247
+
|`:??\_alias_??/c`
248
+
|`:c`
249
+
250
+
|===
129
251
* Potentially breaking
130
252
** Switched to `clojure.tools.reader.edn`
131
253
** Some rewrite-cljs optimizations were dropped in favor of a single code base
0 commit comments