When executing `macro expand1()` with the compiler unresolvable symbols 
aren't an issue, except if they are fully qualified and their corresponding 
namespace does not exist, in which case a ClassNotFoundException is thrown.
I find this to be inconsistent behaviour, since unresolvable symbols 
themselves do not cause such an exception.

My concrete use case here (to justify this change) is that I currently work 
on an Embedded Domain Specific Language (EDSL) in Clojure, where we adopt 
the namespace and interned symbols idea.
However we want to avoid polluting the clojure namespaces themselves with 
our symbols which are only usable in our EDSL.
Our EDSL is invoked with a macro call and the code inside this macro is 
completely interpreted by out own compiler.
However we want to reuse some of the Clojure internal macros, such as `let` 
and `cond`, we therefore run a macro expand over the code before we start 
interpreting it.
Since our import system doesn't actually produce a clojure namespace the 
macro expand call crashes on us if there are fully qualified symbols in the 
EDSL code.
I'd like to avoid having to create an empty namespace each time we do a 
require in our EDSL and therefore propose to add a catch for the class 
loading exception in `macroexpand()`.

*Note: our compiler is able to handle fully qualified symbols and aliasing 
without using clojures resolving*

Example:

This code is valid:

(ns my-ns
  (:require [com.ohua.lang :refer [ohua]]))

; This macro brings com.ohua.lang.tests into our internal scope (for ohua), 
but does not create a namespace
(ohua-require [com.ohua.lang.tests :refer [add]])

; this macro enters our EDSL
(ohua
  (add 3 4))

But this code fails in macroexpand1

(ns my-ns
  (:require [com.ohua.lang :refer [ohua]]))

; This macro brings com.ohua.lang.tests into our internal scope (for ohua), 
but does not create a namespace
(ohua-require [com.ohua.lang.tests :refer [add]])

; this macro enters our EDSL
(ohua
  (com.ohua.lang.tests/add 3 4))


-- 
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