[ANN] Clojure 1.8.0-RC2

951 views
Skip to first unread message

Alex Miller

unread,
Nov 16, 2015, 9:32:10 AM11/16/15
to Clojure
Clojure 1.8.0-RC2 is now available. This build is a "release candidate"! We would appreciate any and all testing you can do on your own libraries or internal projects to find problems. 

Try it via
Below are the changes since 1.8.0-RC1. See the full 1.8 change log here: https://github.com/clojure/clojure/blob/master/changes.md.
  • CLJ-1846 Fix VerifyError when primitive type hints are incorrect. These cases now throw compiler errors.
    • Example: (defn foo ^long [] 1)  (Integer/bitCount ^int (foo))
    • In this example, foo returns a long but is type hinted (incorrectly) as an int. This case will now throw a compilation error. The correct way to do this is with a cast:  (Integer/bitCount (int (foo)))
  • CLJ-1825 Fix compilation errors on direct linking of anonymous recursive functions

Ambrose Bonnaire-Sergeant

unread,
Nov 20, 2015, 1:25:28 AM11/20/15
to clojure
I don't think CLJ-1845 had the intended effect.

user=> (alter-var-root #'load (fn [f] (fn [& args] (prn "patched") (apply f args))))
#object[user$eval1241$fn__1242$fn__1243 0x1c857e6 "user$eval1241$fn__1242$fn__1243@1c857e6"]
user=> (load)
"patched"
nil
user=> (require 'clojure.core :reload)
nil
user=> (require 'clojure.tools.analyzer :reload)
nil
user=> (require 'clojure.tools.analyzer :reload-all)
nil

I was expected "patched" to be printed with each call to `load` via `require`.

Do others observe this also?

Thanks,
Ambrose


--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ambrose Bonnaire-Sergeant

unread,
Nov 20, 2015, 9:57:20 AM11/20/15
to clojure
I'm missing something, alter-var-root'ing *clojure-version* works just fine when calling (clojure-version).

(alter-var-root #'*clojure-version* assoc :qualifier "patched")
(clojure-version)
;=> "1.8.0-patched"

Thanks,
Ambrose

Nicola Mometto

unread,
Nov 20, 2015, 10:01:57 AM11/20/15
to clo...@googlegroups.com
*clojure-version* is not a function, it's not affected by direct linking

Alex Miller

unread,
Nov 20, 2015, 10:10:27 AM11/20/15
to Clojure, abonnair...@gmail.com
I see the same and I suspect it's because of the forward declare.  :(

Ambrose Bonnaire-Sergeant

unread,
Nov 20, 2015, 10:22:15 AM11/20/15
to clojure
Wait, how does the compiler know that *clojure-version* isn't a function?

Ambrose Bonnaire-Sergeant

unread,
Nov 20, 2015, 10:22:44 AM11/20/15
to clojure
Alex,

That sounds correct.

Thanks,
Ambrose

Ambrose Bonnaire-Sergeant

unread,
Nov 20, 2015, 10:29:43 AM11/20/15
to clojure
I was going to reopen the ticket and create/test a patch. Does that work for you?

Nicola Mometto

unread,
Nov 20, 2015, 10:35:24 AM11/20/15
to clo...@googlegroups.com
It doesn't, but direct linking only affects invocations

Ambrose Bonnaire-Sergeant

unread,
Nov 20, 2015, 10:37:08 AM11/20/15
to clojure
Aha, thanks!

Alex Miller

unread,
Nov 20, 2015, 10:55:00 AM11/20/15
to Clojure, abonnair...@gmail.com
I reopened the ticket. You can hold on the patch - I think we're going to make another change that will affect what the patch will be.
Ambrose



For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.

Ambrose Bonnaire-Sergeant

unread,
Nov 20, 2015, 10:56:51 AM11/20/15
to clojure
Thanks.

Here's a good test, feel free to use it.

(deftest direct-linking-for-load
  (let [original-load load
        called? (atom nil)
        logger (fn [& args] 
                 (reset! called? true)
                 nil)]
    (with-redefs [load logger]
      ;; doesn't actually load clojure.repl, but should
      ;; eventually call `load` and reset called?.
      (require 'clojure.repl :reload))
    (is @called?)))

Thanks,
Ambrose

Ambrose



For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.

Serzh Nechyporchuk

unread,
Dec 1, 2015, 2:46:22 AM12/1/15
to Clojure
Hello, Alex. Thank you for your work.

Direct linking is a feature that we wait for a long. We need to obfuscate our code, so direct linking is really helps us.
But I wonder, why there is keyword and symbols interning left in the static initalizer in the class:

L1 {
             ldc "clojure.core" (java.lang.String)
             ldc "float?" (java.lang.String)
             invokestatic clojure/lang/RT var((Ljava/lang/String;Ljava/lang/String;)Lclojure/lang/Var;);
             checkcast clojure/lang/Var
             putstatic malt/utils$string_to_double.const__0:clojure.lang.Var
             ...
}

But neither invoke nor invokeStatic doesn't use them.
We want to get rid of this interns because they undermine code obfuscation.

Thank you

Alex Miller

unread,
Dec 2, 2015, 10:47:57 AM12/2/15
to Clojure
Hi Serzh, 

Rich plans to work on this in 1.9 (ticket for tracking here: http://dev.clojure.org/jira/browse/CLJ-1861). 

Thanks,
Alex

Serzh Nechyporchuk

unread,
Dec 3, 2015, 3:35:48 AM12/3/15
to Clojure
Thanks Alex, I will watch on this issue.

середа, 2 грудня 2015 р. 17:47:57 UTC+2 користувач Alex Miller написав:

Serzh Nechyporchuk

unread,
Dec 3, 2015, 3:39:52 AM12/3/15
to Clojure
There is an error in the link in the issue: you leave "):" in the end of url. 

Alex Miller

unread,
Dec 11, 2015, 9:06:37 AM12/11/15
to Clojure
Hey Serzh,

Rich just pushed a change to master that removes unused interns in the static initializers - we are doing some further testing on it before creating an RC but if you wanted to check it out as a snapshot, I'd be interested in hearing your feedback in particular as you have a specific need for it. 

You can see info on how to use a snapshot build of Clojure here (you need to add the snapshot Maven repository):

Alex

On Tuesday, December 1, 2015 at 1:46:22 AM UTC-6, Serzh Nechyporchuk wrote:
Reply all
Reply to author
Forward
0 new messages