Clojure 1.3 Alpha 2

6 views
Skip to first unread message

Stuart Halloway

unread,
Oct 25, 2010, 3:44:11 PM10/25/10
to clo...@googlegroups.com
Clojure 1.3 Alpha 2 is now available at

http://clojure.org/downloads

= CHANGES =

 0 Changes from 1.3 Alpha 1 to 1.3 Alpha 2
 1 Changes from 1.2 to 1.3 Alpha 1
 2 About Alpha Releases

= 0 Changes from 1.3 Alpha 1 to 1.3 Alpha 2

  * code path for using vars is now *much* faster for the common case,
    and you must explicitly ask for :dynamic bindability
  * new: clojure.reflect/reflect
  * new: clojure.data/diff

= 1 Changes from 1.2 to 1.3 Alpha 1

  * enhanced primitive support 
  * better exception reporting
  * ancillary namespaces no longer auto-load on startup:
    clojure.set, clojure.xml, clojure.zip

= 2 About Alpha Releases

1.3 is the first release of Clojure that will include a series of
alpha builds. We are adding these builds to support maven and
leiningen users, who want a specific artifact that they can target (as
opposed to building from master or "moving-target" snapshots).

If you are the kind of person who used to track master by building
from source, but no longer do so because you are using maven or
leiningen, alpha releases are for you.

ka

unread,
Oct 27, 2010, 4:16:21 PM10/27/10
to Clojure
Hi,

Please explain this!

Baishampayan Ghose

unread,
Oct 27, 2010, 4:22:24 PM10/27/10
to clo...@googlegroups.com
> Please explain this!
>
>> code path for using vars is now *much* faster for the common case, and you must explicitly ask for :dynamic bindability

Earlier vars were looked up each time they were accessed inside
functions because there was no way of telling if it was being
dynamically rebound or not. Now all vars are cached inside function
calls and are not looked up every time. To be able to dynamically
rebind vars, the metadata :dynamic needs to be present in which case
the vars will be looked up when they are rebound. For global
(non-dynamic) vars, there is a universal var counter which is
incremented each time a var root is altered and when that change is
detected inside functions, they lookup the vars again. Since the
function would use the cached var values happily if the global var
counter is unchanged, they are now way faster.

I hope that helps.

Regards,
BG

--
Baishampayan Ghose
b.ghose at gmail.com

nickikt

unread,
Oct 27, 2010, 5:40:59 PM10/27/10
to Clojure
I'm not sure about this either, just wait for the videos of the conj
then you will get information on this.

Lee Spector

unread,
Nov 5, 2010, 4:06:40 PM11/5/10
to clo...@googlegroups.com

On Oct 25, 2010, at 3:44 PM, Stuart Halloway wrote:
> * code path for using vars is now *much* faster for the common case,
> and you must explicitly ask for :dynamic bindability

This has been bouncing around in my head for the last week or so, occasionally colliding with the memory of Rich Hickey showing dynamic rebinding of vars during a run (in a video, maybe on the ant simulation?) and saying something like "It's a dynamic language!" (apparently with approval).

I understand how this can be a big win on performance and I guess it's a minor sacrifice since one will still be able ask for dynamic bindability with only a little more clutter.

But it leads me to ask whether it would be possible to simultaneously provide a way to load libraries (e.g. in require or :require clauses of ns) while specifying that certain vars in the library are to be defined as dynamically bindable, even if they're not coded as such within the library.

The reason I ask is that I often create a library and then want to use it in a context in which I want one of the library's internal subfunctions to be defined differently. So I load the library and then redefine the subfunction's var (sandwiched between calls to ns, so I'm redefining the var in the right namespace). [Perhaps this is not a recommended way to do things? In any event I find it useful... Is there a better way that's not a lot more work?]

Anyway, I don't know ahead of time, when I write the library, which particular vars I might want to redefine for any particular application/experiment. But I'd rather not change the library's code between experiments; I'd like that to be frozen and constant (and I use the exact same file for many experiments). So if I wanted to make this work in all possible use cases I'd have to designate *all* of my vars as dynamically, but then: A) I'd have to clutter all of my vars with :dynamic specifications and, 2) I'd lose the optimizations that this new feature of 1.3 alpha 2 are providing (which sound worthwhile, being "*much* faster"). It would be nicer if I could define everything in the library in the normal way, and have everything loaded as not-dynamically-bindable in the usual case, but if I could say in a particular application file that loads the library something like:

(ns foo
(:require [bar :dynamic baz bingo]))

Or something to that effect -- I don't know if this exact syntax is consistent with the various options in an ns/require form.

The idea is that this would load bar but with the definitions of baz and bingo marked as dynamically bindable, even though the code in bar.clj doesn't ask for dynamic bindability.

Possible? Desirable?

Thanks!

-Lee

Laurent PETIT

unread,
Nov 5, 2010, 4:43:38 PM11/5/10
to clo...@googlegroups.com
Hello Lee,

2010/11/5 Lee Spector <lspe...@hampshire.edu>:


>
> On Oct 25, 2010, at 3:44 PM, Stuart Halloway wrote:
>>   * code path for using vars is now *much* faster for the common case,
>>     and you must explicitly ask for :dynamic bindability
>
> This has been bouncing around in my head for the last week or so, occasionally colliding with the memory of Rich Hickey showing dynamic rebinding of vars during a run (in a video, maybe on the ant simulation?) and saying something like "It's a dynamic language!" (apparently with approval).
>
> I understand how this can be a big win on performance and I guess it's a minor sacrifice since one will still be able ask for dynamic bindability with only a little more clutter.
>
> But it leads me to ask whether it would be possible to simultaneously provide a way to load libraries (e.g. in require or :require clauses of ns) while specifying that certain vars in the library are to be defined as dynamically bindable, even if they're not coded as such within the library.
>
> The reason I ask is that I often create a library and then want to use it in a context in which I want one of the library's internal subfunctions to be defined differently.  So I load the library and then redefine the subfunction's var (sandwiched between calls to ns, so I'm redefining the var in the right namespace).  [Perhaps this is not a recommended way to do things? In any event I find it useful... Is there a better way that's not a lot more work?]

If I understand well, you are re-def'ing the var. If so, then no
problem, because you have mistaken "redefinition of a var" for
"dynamic rebinding of a var".

redefinition of a var will still be possible for non dynamically
rebindable vars. (or we could then just stop to work on the REPL with
Chas !)

>
> Anyway, I don't know ahead of time, when I write the library, which particular vars I might want to redefine for any particular application/experiment. But I'd rather not change the library's code between experiments; I'd like that to be frozen and constant (and I use the exact same file for many experiments). So if I wanted to make this work in all possible use cases I'd have to designate *all* of my vars as dynamically, but then: A) I'd have to clutter all of my vars with :dynamic specifications and, 2) I'd lose the optimizations that this new feature of 1.3 alpha 2 are providing (which sound worthwhile, being "*much* faster"). It would be nicer if I could define everything in the library in the normal way, and have everything loaded as not-dynamically-bindable in the usual case, but if I could say in a particular application file that loads the library something like:
>
> (ns foo
>  (:require [bar :dynamic baz bingo]))
>
> Or something to that effect -- I don't know if this exact syntax is consistent with the various options in an ns/require form.
>
> The idea is that this would load bar but with the definitions of baz and bingo marked as dynamically bindable, even though the code in bar.clj doesn't ask for dynamic bindability.
>
> Possible? Desirable?
>
> Thanks!
>
>  -Lee
>

> --
> 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

Lee Spector

unread,
Nov 5, 2010, 5:02:30 PM11/5/10
to clo...@googlegroups.com

On Nov 5, 2010, at 4:43 PM, Laurent PETIT wrote:
>
> If I understand well, you are re-def'ing the var. If so, then no
> problem, because you have mistaken "redefinition of a var" for
> "dynamic rebinding of a var".
>
> redefinition of a var will still be possible for non dynamically
> rebindable vars. (or we could then just stop to work on the REPL with
> Chas !)


Ah -- beautiful.

I completely misunderstood and was "borrowing worries," as we say in my family.

Maybe it's from my time in the Lisp/Scheme world, where "binding" in used more broadly (I think!).

Thanks so much!

-Lee

Reply all
Reply to author
Forward
0 new messages