Skip to content

Commit d3f58ff

Browse files
committed
docs(changelog): record rounds 5-6 under [Unreleased]
Adds the user-visible changes since v1.14.12 that had no entry: the java.lang.Number instance methods, wide ratio literals, RT/nextID, IRecord / Fn / Map$Entry interop, script args to *command-line-args*, large collection literals (D-346), the 1024-group regex cap, the doubleValue conversions, temporal hash parity, interface-driven predicates, CharSequence acceptance, macro class forms, and the smaller fixes from PRs #36-#40, #44, #48 and #52-#56.
1 parent dab0edb commit d3f58ff

1 file changed

Lines changed: 125 additions & 0 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,62 @@ first stable `1.0.0` tag; pre-1.0 `alpha` / `rc` tags may still change surfaces.
2929
(`-Dffi=false` drops it); absent on wasm. Example:
3030
`docs/examples/ffi/hive_call.clj` drives the hive C ABI.
3131

32+
- **`java.lang.Number` instance methods on every number.** Long, Double,
33+
BigInt, Ratio and BigDecimal answer `.intValue`, `.longValue`,
34+
`.shortValue`, `.byteValue`, `.doubleValue` and `.floatValue`; Long, Double,
35+
BigInt and Ratio also answer the class-gated `.compareTo`, `.equals` and
36+
`.hashCode` with their JVM semantics (not clj `=` / `hash`), and a Double
37+
answers `.isNaN` and `.isInfinite`. Narrowing follows the JLS: an integer
38+
keeps its low bits, a Double truncates toward zero and saturates, NaN gives
39+
0. `.floatValue` answers the double, as `(float x)` does (AD-004).
40+
41+
- **Ratio literals wider than a Long.** `24691357802469135781/2` reads as a
42+
Ratio in source, `read-string` and `clojure.edn/read-string`, and a literal
43+
that divides evenly collapses to a Long or BigInt exactly as `/` does. Such
44+
ratios compare, `max`/`min` and truncate (`bigint`, `biginteger`) by exact
45+
value, never through doubles; `long` and `int` still reject one past their
46+
range.
47+
48+
- **`clojure.lang.RT/nextID`.** Returns the next value of the per-runtime
49+
gensym counter, so ids are monotonic and never collide with gensym
50+
suffixes. core.logic mints logic-variable ids with it.
51+
52+
- **`clojure.lang.IRecord` and `clojure.lang.Fn` as interfaces.** Every
53+
defrecord is an `(instance? clojure.lang.IRecord r)`, and `extend-type` /
54+
`extend-protocol` onto `IRecord` reaches every record (after the record's
55+
own impls, before an `Object` default). `clojure.lang.Fn` names fns,
56+
builtins and protocol fns, but not a MultiFn or an invocable keyword or
57+
collection, as in clj. `(. Class member)` and `(. Class (member args))` on
58+
a class symbol are static access, for fields as well as methods.
59+
60+
- **A `deftype` or `reify` can implement `java.util.Map$Entry`.** Declaring
61+
`java.util.Map$Entry` or `clojure.lang.IMapEntry` with `getKey` /
62+
`getValue` makes `key`, `val` and `map-entry?` answer the instance, and the
63+
methods stay dot-callable. core.logic's `Pair` loads.
64+
3265
### Changed
3366

67+
- **`cljw script.clj a b` passes `a b` to the script.** Every token after
68+
the script path is bound to `*command-line-args*`, as `clojure script.clj
69+
a b` does; cljw used to open `a` as another source file. A `-cp` /
70+
`--classpath <dirs>` directly after the script path is still the classpath
71+
option (`cljw app.clj -cp lib`); the first other token starts the script
72+
arguments, and everything from there on is an argument.
73+
74+
- **Large collection literals build at any size.** A vector, map or set
75+
literal of constants folds into one constant, and one with evaluated
76+
elements is built in bounded steps, so `[1 1 1 … 40000 elements]` no longer
77+
ends the process with an uncatchable operand stack overflow (D-346). Code
78+
past a compiler limit raises the catchable `form_too_large`, and a full
79+
operand arena the catchable `stack_overflow`. `cljw build` writes bytecode
80+
format v12.
81+
82+
- **Regex patterns take up to 1024 capturing groups** (was 7). The 8th group
83+
used to be reported as an unsupported feature; emmy.complex's number
84+
pattern has 8. More than 1024 raises a catchable "too many capturing
85+
groups" error, and a backreference is still unsupported but now named as
86+
such.
87+
3488
- **`wasm/run` compiles a module once and reuses it.** The first `(wasm/run
3589
path …)` validates and JIT-compiles the module; later runs of the same file
3690
only instantiate and run it, each with its own `:args`, `:stdin`, `:env`,
@@ -69,6 +123,77 @@ first stable `1.0.0` tag; pre-1.0 `alpha` / `rc` tags may still change surfaces.
69123
array, hash and sorted maps and sets and transient sets, as in clj. A
70124
transient map's `find` keeps the probe key, as `ATransientMap.entryAt` does.
71125

126+
- **Ratio and BigDecimal convert to double as clj's `doubleValue`.** A Ratio
127+
rounds through a DECIMAL64 quotient and a BigDecimal rounds once to the
128+
nearest double, in `double`, float contagion, mixed comparison, `format`
129+
and `.doubleValue` alike: `(double 2/3)` is `0.6666666666666667`, `(double
130+
0.3M)` is `0.3` and `(== 2/3 0.6666666666666667)` is true, where cljw gave
131+
`0.6666666666666666`, `0.30000000000000004` and false. `(double 1e400M)` is
132+
`##Inf`, not NaN. `(/ Long/MIN_VALUE 1)` is a BigInt, as in clj.
133+
134+
- **`Long/valueOf` raises IllegalArgumentException on an unmatched
135+
overload.** A BigInt or a Double argument used to raise a type error no
136+
`catch IllegalArgumentException` caught; `nil` raises
137+
NumberFormatException, as in clj.
138+
139+
- **Equal Date and java.time values hash alike.** `Date`, `Timestamp`,
140+
`Instant`, `Duration`, `LocalDate`, `LocalDateTime` and `LocalTime` hash by
141+
their JDK `hashCode`, so `hash-set`, map lookup, `distinct`, `frequencies`
142+
and `group-by` no longer split equal instances. `compare` orders two
143+
`java.sql.Timestamp`s (millis, then nanos); a Timestamp against a Date still
144+
raises.
145+
146+
- **Collection predicates answer a `deftype` or `reify` from its declared
147+
interfaces.** `seq?`, `coll?`, `counted?`, `sequential?`, `associative?`,
148+
`vector?`, `map?`, `set?`, `sorted?`, `ifn?`, `indexed?`, `reversible?` and
149+
`seqable?` follow the type's interfaces and clj's superinterface closure.
150+
A map entry and the three transients are `ifn?`, as in clj.
151+
152+
- **clojure.string and the regex fns accept any CharSequence.** `trim`,
153+
`blank?`, `split`, `split-lines`, `escape`, `reverse`, `re-find`,
154+
`re-matches`, `re-seq` and the rest read a `StringBuilder` or a
155+
CharSequence `deftype` as its text, and `seq`, `count` and `nth` treat a
156+
`StringBuilder` as a CharSequence. A non-CharSequence is still refused.
157+
158+
- **Macros may return Class objects and `clojure.core`-qualified special
159+
heads.** A class inside a macro expansion, as in `(defmacro m []
160+
[String])`, is re-read as the class symbol that names it (an anonymous
161+
`reify` class raises a named error), and `(clojure.core/defmacro …)`,
162+
`(clojure.core/binding …)` and `(clojure.core/ns …)` analyze like their
163+
bare heads. Emmy's `defgeneric` and sci-macro output load.
164+
165+
- **A destructured `deftype` / `defrecord` method parameter shadows a field
166+
of the same name.** `(f [_ {:keys [a]}] a)` answers the argument's `a`, not
167+
the field's, as on the JVM.
168+
169+
- **`(import '[java.util.concurrent Semaphore])`** accepts the vector prefix
170+
spelling, as the ns `:import` clause already did.
171+
172+
- **NaN-keyed maps keep their values.** `reduce-kv`, `update-keys`,
173+
`update-vals` and printing walk entries, so a key that is not `=` to itself
174+
(`##NaN`, or a list holding it) no longer loses its value or prints a
175+
phantom `k nil` entry.
176+
177+
- **`(.getStackTrace (Thread/currentThread))`** answers an empty array, so
178+
test.check's clojure.test reporter shows a failing property's shrunk
179+
counterexample instead of raising a missing-member error.
180+
181+
- **`wasm/component-invoke` accepts a `wasm/load-component` handle** instead
182+
of refusing it as a non-string path, and dropping a resource of a
183+
single-module component names the missing resource table instead of
184+
reporting a guest trap.
185+
186+
- **`cljw.json/write-str` and `read-str`** call clojure.data.json at call
187+
time, so `with-redefs` of the data.json var reaches them, and both carry a
188+
docstring and arglists.
189+
190+
- **`java.io.File` `.list`, `.listFiles`, `listRoots` and the constructor
191+
survive a collection mid-build**, where a GC during the call could return a
192+
short or empty result.
193+
194+
- **A `defmacro` name with reader metadata** no longer risks a ReleaseSafe
195+
panic during analysis.
196+
72197
## [1.14.12] - 2026-10-01
73198

74199
### Added

0 commit comments

Comments
 (0)