Thanks everyone!
Alyssa Kwan

On Nov 17, 11:10 am, Stuart Halloway <stuart.hallo...@gmail.com>
wrote:
> I am wrong, there was a bug here, and Rich just fixed it.
>
> https://github.com/clojure/clojure/commit/8225407032ea643cbe3db7f35ef...
>
> Please retry against master, and sorry for inflicting more confusion.
>
> Stu
>
>
>
> > Meikel,
>
> > while a good description of how things work in 1.2, it's not accurate for 
> > 1.3, and my point was that Stu's description of how 1.3 works (by using 
> > words like "the function is recompiled") does not match with my own 
> > knowledge of what had been done in 1.3 the days just before the conj.
>
> > Since then, I've been away from #clojure (to my regret) and maybe I've 
> > missed new evolutions on the way it's handled in master.
>
> > Anyway, this concept of "the function is recompiled" feels "weird".
>
> > My own comprehension of how things work in 1.3:
>
> > Each function works through a cached set of var's values, and there's just 
> > a check to see if the cache is stale or not. If the cache is stale (some 
> > vars have been redef's, e.g. their root value has been changed), then the 
> > cache is recomputed.
>
> > 2010/11/17 Meikel Brandmeyer <m...@kotka.de>
> > Hi,
>
> > On 17 Nov., 16:29, David Sletten <da...@bosatsu.net> wrote:
>
> > > > => (defn a
> > > >    ([x] x)
> > > >    ([x y] (+ (a x) (a y))))
> > > > #'user/a
> > > > => (a 1 2)
> > > > 3
> > > > => (def b a)
> > > > #'user/b
> > > > => (b 1 2)
> > > > 3
> > > > => (defn a [x]
> > > >    (- x))
> > > > #'user/a
> > > > => (b 1 2)
> > > > -3
>
> > > Let's call the original function assigned to 'a' a0 and the new one a1. 
> > > After 'a' has been redefined to a1, 'b' still refers to a0. So the 2nd 
> > > call to 'b' invokes a0 with two args (in fact, a1 only takes one arg 
> > > now). But within a0 itself the references to 'a' are being resolved at 
> > > runtime to a1 now, not as references to a0 as before.
>
> > > Are you saying that inside a0 Clojure detects that 'a' means something 
> > > else now and recompiles a0 to point to a1?
>
> > > In any case, this behavior seems weird.
>
> > Isn't that completely logical? Let's name things differently to keep
> > functions and Vars apart. You define a function f and store it in Var
> > a. f references Var a internally. Then you define Var b and store f in
> > it by retrieving it from Var a. By executing (b 1 2) you basically
> > retrieve f from b and call it with two arguments. Inside f, f itself
> > is retrieved from the Var a and called with one argument.
>
> > Now you create a new function g, which you store in Var a (assumption:
> > re-defing an existing Var just replaces its value and does not unmap
> > and map again a fresh Var). Again you execute (b 1 2). Same thing
> > happens: f is retrieved and called with two arguments. Inside f
> > however, now g is retrieved from Var a and called with one argument.
>
> > This actually allows to define memoized recursive functions.
>
> > Sincerely
> > Meikel
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@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+unsubscr...@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 post to this group, send email to clojure@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+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/clojure?hl=en- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to