Re: Macro compile vs run time, appengine-magic defentity

2011-03-30 Thread Thorsten Wilms
On 03/29/2011 10:51 PM, Meikel Brandmeyer wrote: [(with-meta key {:key true})] do not set ID/name. Which Clojure version are you using? If it is 1.2, try (with-meta key {:tag :key}). Clojure 1.2 and your are correct, thanks. I added a comment to remember that variant, for when I switch ver

Re: Macro compile vs run time, appengine-magic defentity

2011-03-29 Thread Meikel Brandmeyer
Hi, Am 29.03.2011 um 21:42 schrieb Thorsten Wilms: > [(with-meta key {:key true})] do not set ID/name. Which Clojure version are you using? If it is 1.2, try (with-meta key {:tag :key}). Sincerely Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" g

Re: Macro compile vs run time, appengine-magic defentity

2011-03-29 Thread Thorsten Wilms
On 03/29/2011 10:52 AM, Meikel Brandmeyer wrote: Ah. Now things become clear. I haven't read the problem correctly. You want [(with-meta key {:key true})]. Thanks, but unfortunately, that builds, but does not set the named key (running number for the ID/name attribute, again). ['^:key key]

Re: Macro compile vs run time, appengine-magic defentity

2011-03-29 Thread Meikel Brandmeyer
Hi, On 29 Mrz., 09:56, Thorsten Wilms wrote: > [^:key key] leads to a datastore field "slug", as that's the argument > for key, but it won't be used as named-key for the record. Ah. Now things become clear. I haven't read the problem correctly. You want [(with-meta key {:key true})]. Sincerely

Re: Macro compile vs run time, appengine-magic defentity

2011-03-29 Thread Thorsten Wilms
On 03/28/2011 10:29 PM, Alan wrote: If you need it quoted in the "def" context: (defmacro def-entity-and-attrs [entity-name key attrs-name attrs] `(do (def ~attrs-name '~attrs) (ds/defentity ~entity-name ~(vec (concat ['^:key key] attrs) Note the ' before attrs. Thank you, wo

Re: Macro compile vs run time, appengine-magic defentity

2011-03-28 Thread Meikel Brandmeyer
Hi, Am 28.03.2011 um 22:35 schrieb Meikel Brandmeyer: >> PS why is there a ' before ^:key? It doesn't seem to me like it does >> anything. > > It quotes the key symbol. Without it you get a similar error to the one you > fixed with the ' in front of the ~attrs. Ah. In fact you don't, because k

Re: Macro compile vs run time, appengine-magic defentity

2011-03-28 Thread Meikel Brandmeyer
Hi, Am 28.03.2011 um 22:29 schrieb Alan: > If you need it quoted in the "def" context: > > (defmacro def-entity-and-attrs [entity-name key attrs-name attrs] > `(do (def ~attrs-name '~attrs) >(ds/defentity ~entity-name ~(vec (concat ['^:key key] > attrs) > > Note the ' before attrs

Re: Macro compile vs run time, appengine-magic defentity

2011-03-28 Thread Alan
If you need it quoted in the "def" context: (defmacro def-entity-and-attrs [entity-name key attrs-name attrs] `(do (def ~attrs-name '~attrs) (ds/defentity ~entity-name ~(vec (concat ['^:key key] attrs) Note the ' before attrs. PS why is there a ' before ^:key? It doesn't seem to m

Macro compile vs run time, appengine-magic defentity

2011-03-28 Thread Thorsten Wilms
Hi! Defining an entity with appengine-magic is straightforward: (ns tlog.models (:require [appengine-magic.services.datastore :as ds])) (ds/defentity Article [^:key slug, title, body, created-t, updated-t]) But there are several places (other files), where that list sans the first