Yesterday, I spent hours trying to figure out why some code didn't work. 
The code is like so:
(defn replace-symbol-in-ast-node [old new ast]
  (tree-replace (symbol old) (symbol new) ast))

I use tree-replace directly like this:
(ast/tree-replace (symbol 'a) (symbol 'c) (ast/sexp->parsley '(+ a b)))

I thought the result would the the same but I was wrong. After hours of 
thinking, I finally figured it out.
Guess what? The 'symbol' function in the first code snippet is not the 
standard 'symbol'. It actually is:
(defn symbol [sym]
  (make-node :atom (core/vector (name sym))))

It's defined in another library. But I stupidly thought it was the standard 
'symbol'.
Part of this was my fault, I guess. I shouldn't have taken it for granted 
and guessed its meaning. But who know? 
In my opinion if we use less :use, it would easier for others to read our 
code and less likely to misunderstand the meaning, or at least *Do Not Use 
*those 
standard names*.*


On Wednesday, July 24, 2013 1:50:50 AM UTC+10, Greg wrote:
>
> I think I read somewhere that :use is no longer encouraged, but I could be 
> mistaken. 
>
> From what I've read, it seems like most people agree that Clojure has too 
> many ways of including/importing/referencing/requiring/using things: 
>
>
> http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html
>  
>
> The above gives a very nice explanation of all the various difference, but 
> it also acknowledges their complexity. 
>
> Since :use uses :require, and since :require can do everything that :use 
> can, can we simplify Clojure programming a bit for newcomers by deprecating 
> the use of :use? The situation in ClojureScript is even worse because it 
> adds :require-macros on top of all the other ways of including files. 
>
> Ideally, it would be awesome if there was just a single directive for 
> everything, but perhaps there's some complicated low-level reason why 
> that's not possible. :-\ 
>
> Thoughts? 
>
> Thanks, 
> Greg 
>
> P.S. If this has already been brought up you have my sincere apologies. 
>
> -- 
> Please do not email me anything that you are not comfortable also sharing 
> with the NSA. 
>
>

-- 
-- 
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/groups/opt_out.


Reply via email to