On Monday, 4 March 2013 01:50:56 UTC-5, edw...@kenworthy.info wrote: > Okay, I think I understand that. > > Does that mean this code could never work as intended in a Clojure > program, only at the repl (which seems a bit of a limitation) or is there a > way to make it work as intended, generating a different id each time? Or is > the whole approach taken in this code flawed? >
The tagged literal approach is best used if you need to store the entity and read it back using edn. So it's perfect for using in a data file. However, if you're generating data in code you've already seen how this can cause problems. In that case, you do what Jonas suggests and use tempid (with the appropriate partition keyword. e.g. :db.part/user). The two approaches offer different tradeoffs. tempid is a function, and can only appear in code (not a data file, or anything else read by edn). Conversely, if the the tagged literal appears in code, then it's possible for it to be referred to more than once in the same transaction, which is almost guaranteed to be counter to what you want. Paul -- -- 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/groups/opt_out.