With Jellz (ne Cells in CL) I want to make reading an attribute of an 
object seem like a normal function call, but reading a cell actually looks 
like this:

(defn- svr [slot me] ;; svr = slot-value-read, me = short version of "self"
>   (when-let [sval (slot @me)]
>     (cond
>      (jz-ref? sval)
>      (case (type @sval)
>        :jzi (:val @sval)
>        :jzf ((:rule @sval) me)
>        (error "jz-ref? type unknown" ))
>      :else sval)))


svr is internal because I plan to hide it. Instead of coding (svr :mass 
kenny) I want to code (mass kenny). And instead of hand-coding:

(defn mass [me] (svr :mass me))


...I want to code (jz/def-jzo-slot :mass).

(defmacro def-jzo-slot [slot]
>   `(defn ~(symbol (subs (str slot) 1)) [~'me]
>      (com.tiltontec.jellz.api/svr ~slot ~'me)))


That worked fine until I moved my testing hacks into a proper test file in 
the test hierarchy and Clojure complained that svr was internal (I forget 
the exact language).

I broke down and made it defn instead of defn-, but was something else 
going on? I am used to Common Lisp which sees what I am up to and worries 
about the symbol being defined in the Cells package, not the package into 
which the macroexpansion will be happening.

I always thought that was very clever and classically XWIW (exactly what I 
want), btw.

This is not a big deal, but did I miss some way of keeping svr internal?

-kt

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