Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the breaking changes in clojure 1.3?

Tags:

clojure

I have been having trouble keeping up with the list of changes in 1.3 and most importantly the changes that require me to change my code.

  • What has changed,
  • what is about to change,
  • where can I get up to date lists of these?
like image 959
Arthur Ulfeldt Avatar asked Oct 29 '10 21:10

Arthur Ulfeldt


2 Answers

Breaking changes to date:

  • Math ops no longer promote into bignums.

  • Math ops no longer narrow the result to the smallest type that can hold them.

  • Vars will no longer default to being dynamically bindable. Add ^:dynamic when needed.

like image 73
Alex Taggart Avatar answered Nov 15 '22 20:11

Alex Taggart


A couple of other numerical changes:

  • There is a new literal for BigIntegers: 5N, which is 5 as a BigInteger.
  • The rules for equality have changed (perhaps arising as a result of the changes Alex mentions?):
    • (= 2 2.0) => false, but (== 2 2.0) => true
    • (= 2 2M) => false, but (== 2 2M) => true
    • (= 2.0 2M) => false, but (== 2.0 2M) => true
    • and for clarity:
      • (= 2 2N) => true
      • (= 2 4/2) => true
    • You can generally assume that you'll need == to compare floating-point numbers for equality (which is still probably a shaky proposition).
like image 33
trptcolin Avatar answered Nov 15 '22 22:11

trptcolin