Repeat several times the magic incantation, dynamic, dynamic, dynamic, .... :)))

Your second definition overrides the first one.

Generating a warning when a redefinition occurs appears to me as not practical.
In the REPL, you would not like it at all.
Add another top level var to enable/disable this 'feature' ? 
That most people would disable anyway ?

Warn when loaded from a file ? Maybe. But the compiler would have to be 
aware of this context.
What about reloading a name space from a file in the REPL then ?

Oups...

Too much trouble IMHO.

Luc P.


> I am new to Clojure, I am currently at Beginner level. While trying to run 
> small programs, I found that I can load a file having duplicate code. Let 
> me explain it with example.
> 
> This is the code
> 
> (ns clojure_begins_19_08_2014.core)
> 
> (defn first-fn[x]
>   (print x))
> 
> (defn first-fn[x]
>   (print "Value of x with String " x))
> 
> (first-fn 10)
> 
> See, above code consists of two function with same name and with same 
> number of arguments.
> When I call first-fn, the function declared later gets called. I get output 
> as:
> 
> Value of x with String  10
> nil
> 
> So can any one explain how this thing is happening and also explain how we 
> can have same function written 2 times in a same namespace.
> 
> -- 
> 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 unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> 
--
Softaddicts<lprefonta...@softaddicts.ca> sent by ibisMail from my ipad!

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to