Include changes from clojure-1.9.0
jfacorro opened this issue Β· comments
Juan Facorro commented
Go over the changelog for Clojure 1.9.0 and apply them to Clojerl.
Review the code changes by checking out tag clojure-1.9.0
and then running git dif clojure-1.8.0
.
Reference:
- Applicable π©
- Maybe Applicable π¨
- Not Applicable π₯
Changes to Clojure in Version 1.9
- 1 New and Improved Features
- 1.1 spec π©
- 1.2 Support for working with maps with qualified keys π©
- 1.3 New predicates π©
- 1.4 More support for instants π¨
- 1.5 Other new core functions π©
- 1.6 Other reader enhancements
- Can now bind reader-resolver to an impl of LispReader$Resolver to control the readerβs use of namespace interactions when resolving autoresolved keywords and maps. π¨
- Add new ## reader macro for symbolic values, and read/print support for double vals ##Inf, ##-Inf, ##NaN (CLJ-1074) π₯
There is no representation for Inf, -Inf or NaN in the BEAM that would play nicely with the available number types.
- 2 Enhancements
- 2.1 Spec syntax checking π©
- 2.2 Documentation π©
- 2.3 Performance
- Improved update-in performance π©
- Optimized seq & destructuring π©
- CLJ-2210 Cache class derivation in compiler to improve compiler performance π₯
There are no classes in the BEAM. - CLJ-2188
slurp
- mark return type as String π© - CLJ-2070
clojure.core/delay
- improve performance π₯
Delay has a completely different implementation in Clojerl, therefore the performance improvement does not apply. - CLJ-1917 Reducing seq over string should call String/length outside of loop π¨
There is an implementation of StringSeq but there is noInternalReduce
protocol in Clojerl (or any of the logic aroundCollReduce
either). This is because most of that implementation relies on the hierachy of classes in the JVM. The alternative chosen in Clojerl is to implement theclojerl.IReduce
protocol for the collections and seqs that would be included in the original Clojure logic. Following this reasoning,clojerl.StringSeq
does not implementIReduce
so we should probably add that. - CLJ-1901
amap
- should call alength only once π₯
There are no arrays in the BEAM. - CLJ-1224 Record instances now cache hasheq and hashCode like maps π₯
This cache is implemented usingunsynchronized-mutable
in Clojure JVM. There is no way to cache values in this way on the BEAM. There are ways (e.g. calculate the hash when the record is created or updated) but none of them are robust enough and/or the trade-off seem worthy. - CLJ-99
min-key
andmax-key
- evaluate k on each arg at most once π©
- 2.4 Other enhancements
- Added Var serialization for identity, not value π₯
There is nojava.io.Serializable
equivalent on the BEAM. -
into
now has a 0-arity (returns[]
) and 1-arity (returns the coll that's passed) π© - CLJ-2184 Propagate meta in doto forms to improve error reporting π©
- CLJ-1744 Clear unused locals, which can prevent memory leaks in some cases π₯
After checking the linked issue, this does not seem to cause any issues (tried with OTP 24), it could be because the BEAM compiler includes a pass to remove unusued locals, and therefore there is no lingering reference to the lazy seq head. We could confirm this by compiling the expression in the issue (i.e.(loop [[a & b] c] [a b])
) and check the assembler BEAM code generated for it by providing the--to-asm
tobin/clj
orbin/clojure
. - CLJ-1673
clojure.repl/dir-fn
now works on namespace aliases π© - CLJ-1423 Allow vars to be invoked with infinite arglists (also, faster) π©
- Added Var serialization for identity, not value π₯
- 3 Fixes
- 3.1 Security π₯
There is only one change in this section which is related serialization of proxy classes, neither of which are available in this implementation. - 3.2 Docs π©
- 3.3 Other fixes
-
clojure.core/Throwable->map
formerly returnedStackTraceElement
s which were later handled by the printer. Now the StackTraceElements are converted to data such that the return value is pure Clojure data, as intended. π₯
There is no Throwable class in the BEAM, any value can be use in a throw expression. However Clojerl defines theIError
protocol which it uses to provide user defined errors and more Clojuresque error handling. This is whyThrowable->map
was renamed toIError->map
. - CLJ-2091
clojure.lang.APersistentVector#hashCode
is not thread-safe π₯
There are no threads on the BEAM, every value is immutable and each process keeps its state (note: this does not mean that there can't be race conditions between processes though). - CLJ-2077 Clojure can't be loaded from the boot classpath under java 9 π₯
JVM specific. - CLJ-2048 Specify type to avoid ClassCastException when stack trace is elided by JVM π₯
JVM specific. - CLJ-1914 Fixed race condition in concurrent
range
realization π₯
See comment for CLJ-2091 above. - CLJ-1887
IPersistentVector.length()
- implement missing method π₯
This is related togvec
's implementation which is used invector-of
which is not supported in Clojerl. - CLJ-1870 Fixed reloading a
defmulti
removes metadata on the var π© - CLJ-1860 Make -0.0 hash consistent with 0.0 π©
- CLJ-1841
bean
- iterator was broken π₯
JVM specific. - CLJ-1793 Clear 'this' before calls in tail position π₯
JVM specific. - CLJ-1790 Fixed error extending protocols to Java arrays π₯
JVM specific. - CLJ-1714 using a class in a type hint shouldnβt load the class π₯
JVM specific. - CLJ-1705
vector-of
- fix NullPointerException if given unrecognized type π₯
vector-of
not supported in Clojerl. - CLJ-1398
clojure.java.javadoc/javadoc
- update doc urls π₯
JVM specific. - CLJ-1371
Numbers.divide(Object, Object)
- add checks for NaN π₯
There is no NaN on the BEAM. - CLJ-1358
doc
- does not expand special cases properly (try, catch) π© - CLJ-1242 equals doesn't throw on sorted collections π₯
It never did on Clojerl. - CLJ-700
contains?
,get
, andfind
broken for transient collections π₯
No support for transient collections in Clojerl.
-
- 3.1 Security π₯
Juan Facorro commented
make time
master
________________________________________________________
Executed in 26.89 secs fish external
usr time 41.36 secs 111.00 micros 41.36 secs
sys time 6.52 secs 841.00 micros 6.52 secs
793-include-spec.alpha-for-clojure-1.9.0
Without check_specs
________________________________________________________
Executed in 40.18 secs fish external
usr time 59.46 secs 86.00 micros 59.46 secs
sys time 9.71 secs 596.00 micros 9.71 secs
With check_specs
________________________________________________________
Executed in 39.42 secs fish external
usr time 57.75 secs 125.00 micros 57.75 secs
sys time 9.28 secs 913.00 micros 9.28 secs
time make ci
master
________________________________________________________
Executed in 446.96 secs fish external
usr time 810.17 secs 141.00 micros 810.17 secs
sys time 64.07 secs 944.00 micros 64.07 secs
793-include-spec.alpha-for-clojure-1.9.0
Without check_specs
________________________________________________________
Executed in 481.53 secs fish external
usr time 836.13 secs 95.00 micros 836.13 secs
sys time 66.34 secs 713.00 micros 66.34 secs
With check_specs
________________________________________________________
Executed in 481.96 secs fish external
usr time 836.67 secs 114.00 micros 836.67 secs
sys time 69.47 secs 780.00 micros 69.47 secs