It seems to me that the real solution is that the Clojure compiler
needs to support global constants.  You could probably emulate the
behaviour by rebinding global vars inside the let though.

(def *foo* 100)
(defn bar []
 (let [foo *foo*]
  ...))

Brad

On Apr 2, 7:57 am, Paul Stadig <p...@stadig.name> wrote:
> I think you are right, Brad.
>
> However, I wonder though if there is a better way to define a constant.
> Neither the macro nor function seems clean. I like David's
> wrapping-the-whole-thing-in-a-let, but what if you wanted to access the
> value of "width" in a different file? Would one have to resort to defining a
> Java class (at compile time or runtime)?
>
> Paul
>
> On Thu, Apr 2, 2009 at 10:47 AM, Bradbev <brad.beveri...@gmail.com> wrote:
>
> > It would seem that macros in this case should not be required.  A
> > normal function that simply returns a constant should get inlined by
> > the JIT.
>
> > Cheers,
> > Brad
--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to