Hi Laurent,

On Sep 30, 9:46 am, Laurent PETIT <laurent.pe...@gmail.com> wrote:

> Where should the responsability be placed ? Should the user of the library,
> in doubt, place everywhere in his code bind-fn calls to protect it ? Should
> the library author use bind-fn before dispatching to other threads (with the
> problem that the library author may not know which dynamic vars are
> relevant) ...

I think the responsibility should be placed with the one creating
another thread. There are several scenarios:
* in the library:
  * if only library code is involved the author knows (hopefully)
whether the dynamic environment must be saved or not
  * if a user callback is involved, require it to be pure (ie.
depending only on the arguments) or
  * use bound-fn to be safe if non-pure functions are allowed.
* in the user code:
  * the user of the library should now, when library functions are non-
pure and hence bound-fn is necessary for a new thread.

Dynamic Vars have a high correlation with side-effects. So making such
things sufficiently ugly (but not too ugly) helps to make you aware of
side-effects and keep them apart of the (hopefully existing)
functional core. There are already examples where only non-side-
effecting functions are allowed: in transactions, as validators, ...

Does this make sense?

Sincerely
Meikel

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