Miki:

This is what Sunil is talking about:
http://en.wikipedia.org/wiki/Common_Lisp#Variable_capture_and_shadowing

The "symbol#" string is a part of how syntax-quote works.  Read
http://clojure.org/reader#The Reader--Macro characters

On Mon, Nov 8, 2010 at 10:12 AM, Sunil S Nandihalli
<sunil.nandiha...@gmail.com> wrote:
> Hi Miki,
>  Just to elaborate on what I said before, session# creates a new symbol
> using gensym with a prefix session. It avoids accidental variable capture.
> Sunil.
>
> On Mon, Nov 8, 2010 at 8:40 PM, Sunil S Nandihalli
> <sunil.nandiha...@gmail.com> wrote:
>>
>> use session# instead of session .. I think that should work.. try it..
>>
>> On Mon, Nov 8, 2010 at 8:32 PM, Miki <miki.teb...@gmail.com> wrote:
>>>
>>> Greetings,
>>>
>>> I need some help with the 1'st macro I'm writing.
>>> I have many tests in the format
>>>
>>> (deftest user-test
>>>  (let [session (test-session :authorization)]
>>>    (dispatcher "USER bugs" session)
>>>    (is (= (:user @session) "bugs"))
>>>    (is (= (get-one session) "+OK Hello bugs\n"))))
>>>
>>> I've tried writing
>>>
>>> (defmacro def-dispatcher-test [test-name state command & body]
>>>  `(deftest ~test-name
>>>     (let [session (test-session ~state)]
>>>       (dispatcher ~command session)
>>>       ~...@body)))
>>>
>>> (def-dispatcher-test user-test :authorization "USER bugs"
>>>    (is (= (:user @session) "bugs"))
>>>    (is (= (get-one session) "+OK Hello bugs\n")))
>>>
>>>
>>> But I get the following error;
>>>
>>> Caused by: java.lang.Exception: Can't let qualified name: pop32imap-
>>> test/session
>>>
>>>
>>> I probably need to add some magic to the session expansion, but can't
>>> figure out what.
>>>
>>> Thanks,
>>> --
>>> Miki
>>>
>>> --
>>> 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 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



-- 
Cheers,
Leif

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

Reply via email to