http://stuartsierra.com/2013/03/29/perils-of-dynamic-scope is a good
read around this subject.

On 21 March 2015 at 21:47, coco <clasesparticulares...@gmail.com> wrote:
> Hi guys, I'm curious about how work some codes with binding and dynamics
> vars, for instance, in sqlkorma you define your db settings
>
> (defdb prod (postgres {:db "korma"
>                        :user "db"
>                        :password "dbpass"}))
>
>
> and then you can use other functions like this
>
> (select user
>   (with address)
>   (fields :firstName :lastName :address.state)
>   (where {:email "ko...@sqlkorma.com"}))
>
>
> without pass your config db as parameter..
>
> some korma functions expects your db configuration as first parameter...but
> if you had defined your db before using defdb macro, then you can omit this
> parameter
>
>
> (defentity users
>   ;; Basic configuration
>   (pk :id) ;; by default "id". This line is unnecessary.
>            ;; it's used for relationships joins.
>   (table :users) ;; by default the name of the symbol.
>                  ;; The line above is also unecessary.
>   (database db) ;; if none is specified the last defdb  <-------
>                 ;; will be used. Also unnecessary.
>
> ....)
>
>
> I've found this pattern in many clojure codes, but I can't understand how it
> works..can someone provides me a simple and clear example about how write
> something like this?..thank so much!
>
> --
> 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.

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