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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to