klang
unread,Oct 14, 2009, 7:37:40 AM10/14/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Clojure
Somehow, namespaces are resolved by the REPL, eventhough they are
inside a comment.
;;The following can be executed line by line in a REPL
;; resolves symbol in the current namespace
(comment ::bar)
;; resolves symbol in namespace foo
(comment ::foo/bar)
;; that is illegal (foo does not exist, indicating that the body of
comment is _not_ ignored?)
(ns foo)
;; create namespace foo and it becomes legal
(comment ::foo/bar)
;; Usage for this specific way to comment:
;; Telling a user how to use foo from somewhere else if the path to
foo is anoyingly long
(comment
(alias 'fii 'foo)
::fii/bar)
;; No, this will not work, as fii does not exist, as the alias fii
does not exist in namespace foo and it shouldn't as this is just a
helpfull comment for the user of the namespace.
;; solution. when defining a namespace, remenber to make an alias to
the namespace if you want to make a comment using local symbols
;; file foo.clj containing
(ns foo)
(alias 'fii 'foo)
;; <loads of really cool code>
(comment
alias 'fii 'foo
::fii/bar)
;; end
So, my question is .. is this an error or a feature .. or should I
just use ;; for comments?
/klang