clojerl / clojerl

Clojure for the Erlang VM (unofficial)

Home Page:http://try.clojerl.online/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Include changes from clojure-1.9.0

jfacorro opened this issue Β· comments

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 no InternalReduce protocol in Clojerl (or any of the logic around CollReduce 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 the clojerl.IReduce protocol for the collections and seqs that would be included in the original Clojure logic. Following this reasoning, clojerl.StringSeq does not implement IReduce 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 using unsynchronized-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 and max-key - evaluate k on each arg at most once 🟩
    • 2.4 Other enhancements
      • Added Var serialization for identity, not value πŸŸ₯
        There is no java.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 to bin/clj or bin/clojure.
      • CLJ-1673 clojure.repl/dir-fn now works on namespace aliases 🟩
      • CLJ-1423 Allow vars to be invoked with infinite arglists (also, faster) 🟩
  • 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 returned StackTraceElements 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 the IError protocol which it uses to provide user defined errors and more Clojuresque error handling. This is why Throwable->map was renamed to IError->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 to gvec's implementation which is used in vector-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, and find broken for transient collections πŸŸ₯
        No support for transient collections in Clojerl.

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