Skip to content

Commit a9f0cd8

Browse files
committed
Changelog: more on namespaced elements [skip ci]
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
1 parent c13420d commit a9f0cd8

File tree

1 file changed

+150
-28
lines changed

1 file changed

+150
-28
lines changed

CHANGELOG.adoc

Lines changed: 150 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,25 @@ Rewrite-cljs users migrating to rewrite-clj v1 are now at, and will remain at, f
5858
* Many updates to docs and docstrings
5959

6060
==== Fixes
61-
* end of line variants in source now normalized consistently to `\newline` https://github.com/clj-commons/rewrite-clj/issues/93[#93]
62-
* postwalk on larger source file no longer throws StackOverflow https://github.com/clj-commons/rewrite-clj/issues/69[#69]
63-
* postwalk now walks in post order https://github.com/clj-commons/rewrite-clj/issues/123[#123]
64-
* we now preserve newline at end of file https://github.com/clj-commons/rewrite-clj/issues/121[#121]
65-
* support for garden style selectors https://github.com/clj-commons/rewrite-clj/issues/92[#92]
66-
* correct and document prefix and suffix functions https://github.com/clj-commons/rewrite-clj/issues/91[#91]
67-
* positional metadata added by the reader is elided on coercion https://github.com/clj-commons/rewrite-clj/issues/90[#90]
68-
* can now read `\\##Inf`, `##-Inf` and `##Nan` https://github.com/clj-commons/rewrite-clj/issues/75[#75]
69-
* ensure that all rewrite-clj nodes coerce to themselves
70-
* strings now coerce to string nodes (instead of to token nodes) https://github.com/clj-commons/rewrite-clj/issues/126[#126]
71-
* regexes now coerce to regex nodes https://github.com/clj-commons/rewrite-clj/issues/128[#128]
72-
* regex node now:
61+
* OS specific end of line variants in source now normalized consistently to `\newline` https://github.com/clj-commons/rewrite-clj/issues/93[#93]
62+
* Postwalk on larger source file no longer throws StackOverflow https://github.com/clj-commons/rewrite-clj/issues/69[#69]
63+
* Postwalk now walks in post order https://github.com/clj-commons/rewrite-clj/issues/123[#123]
64+
* We now preserve newline at end of file https://github.com/clj-commons/rewrite-clj/issues/121[#121]
65+
* Support for garden style selectors https://github.com/clj-commons/rewrite-clj/issues/92[#92]
66+
* Correct and document prefix and suffix functions https://github.com/clj-commons/rewrite-clj/issues/91[#91]
67+
* Positional metadata added by the reader is elided on coercion https://github.com/clj-commons/rewrite-clj/issues/90[#90]
68+
* Can now read `\\##Inf`, `##-Inf` and `##Nan` https://github.com/clj-commons/rewrite-clj/issues/75[#75]
69+
* Ensure that all rewrite-clj nodes coerce to themselves
70+
* Strings now coerce to string nodes (instead of to token nodes) https://github.com/clj-commons/rewrite-clj/issues/126[#126]
71+
* Regexes now coerce to regex nodes https://github.com/clj-commons/rewrite-clj/issues/128[#128]
72+
* Regex node now:
7373
** converts correctly to string https://github.com/clj-commons/rewrite-clj/issues/127[#127]
7474
** reports correct length https://github.com/clj-commons/rewrite-clj/issues/130[#130]
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.
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.
8080

8181
==== Internal changes (developer facing)
8282
* 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
114114

115115
==== Unreleased Breaking Changes
116116

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?`
126121
* 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+
|===
129251
* Potentially breaking
130252
** Switched to `clojure.tools.reader.edn`
131253
** Some rewrite-cljs optimizations were dropped in favor of a single code base

0 commit comments

Comments
 (0)