@@ -5,6 +5,11 @@ A library with various basic utilities for programming with Clojure.
5
5
[ ![ Clojars Project] ( https://img.shields.io/clojars/v/de.active-group/active-clojure.svg )] ( https://clojars.org/de.active-group/active-clojure )
6
6
[ ![ Actions Status] ( https://github.com/active-group/active-clojure/workflows/Tests/badge.svg )] ( https://github.com/active-group/active-clojure/actions )
7
7
8
+ ### Breaking changes in version 0.38
9
+
10
+ - For an RTD record ` MyRecord ` , ` (MyRecord :meta) ` will no longer
11
+ return a meta data map. Use ` (meta #'MyRecord) ` instead.
12
+
8
13
### Breaking changes since version ` 0.28.0 `
9
14
- Clojure version 1.9.0 or higher and Clojurescript version 1.9.542 or higher
10
15
are required.
@@ -180,18 +185,26 @@ You can also override the defaultly implemented interfaces/protocols by the same
180
185
means. You don't have to provide every method of a default interface, those left
181
186
out by you will remain the default ones.
182
187
183
- #### Java Class
184
-
185
- Default is ` true ` .
188
+ #### Java Classes, RTD records
186
189
187
- If you provide the key: val pair ` :java-class? ` :` false ` , no java class is created
188
- for the given type, and instead a ` record-type-descriptor ` is created.
190
+ By default ` define-record-type ` generates new types in the host
191
+ language (Java for Clojure or JavaScript for ClojureScript), just
192
+ like ` defrecord ` does. That can be changed by specifying either
193
+ ` :java-class? false ` , or ` rtd-record? true ` options like so:
189
194
195
+ ``` clojure
196
+ (r/define-record-type Foo {:rtd-record? true }
197
+ ... )
198
+ ```
190
199
191
- #### RTD record
200
+ These records have the advantage, that a hot code reload of the same
201
+ definition will not create a new type in the host language. So record
202
+ values created before the code reload are still compatible with the
203
+ record type, unless its fields have changed of course.
192
204
193
- If you provide the key: val pair ` :rtd-record? ` :` true ` , an own record
194
- implementation for ClojureScript is used instead of ` defrecord ` .
205
+ You cannot define protocol implementations for these kinds of record
206
+ types, but you can use multi methods. Use the defined type and the
207
+ result of ` r/record-type ` as the dispatch value for that.
195
208
196
209
#### Meta data
197
210
@@ -200,7 +213,7 @@ MyRecord)`. This meta data is then "inherited" to all created symobls
200
213
(like ` ->MyRecord ` ).
201
214
202
215
If you use an RTD record (` :java-class? ` , ` :rtd-record? ` options), this data
203
- is retrievable via ` (MyRecord : meta) ` .
216
+ is also retrievable via ` (meta #'MyRecord ) ` .
204
217
205
218
206
219
0 commit comments