Re: ClojureScript def, vars, and binding

2016-04-03 Thread whitespace
Any chance that this could be supported now core.async is here? I think the arguments of brandon bloom are still valid. I have implemented Erlang-like supervisors for core.async and now got stuck in the last step when I realized that the supervisor binding is broken in cljs. (1) I can pass expl

Re: ClojureScript def, vars, and binding

2013-01-14 Thread David Nolen
There is not. On Monday, January 14, 2013, Stuart Campbell wrote: > Sorry to dig up such an old thread. > > I'd also like to maintain the bindings of dynamic vars across asynchronous > function calls. > > Is there a workaround that people use in the absence of bound-fn, etc? > > Cheers, > Stuart

Re: ClojureScript def, vars, and binding

2013-01-14 Thread Stuart Campbell
Sorry to dig up such an old thread. I'd also like to maintain the bindings of dynamic vars across asynchronous function calls. Is there a workaround that people use in the absence of bound-fn, etc? Cheers, Stuart On Friday, 27 January 2012 16:49:10 UTC+11, Brandon Bloom wrote: > > The ClojureS

Re: ClojureScript def, vars, and binding

2012-02-18 Thread Brandon Bloom
> I think the question is whether ClojureScript needs to support bound-fn at all. But maybe it really is useful in a single-threaded environment! :) I'm already finding it very useful for an experimental UI framework design I'm working on. I have a dynamically bound "insert pointer", such that U

Re: ClojureScript def, vars, and binding

2012-02-17 Thread David Nolen
On Fri, Feb 17, 2012 at 1:37 PM, Brandon Bloom wrote: > The problem is dealing with with asynchronous code, right? Not capturing >> / restoring dynamic bindings. >> > > No, the problem is that there is no mechanism to capture and restore > dynamic bindings. > > This is a shortcoming irrespective

Re: ClojureScript def, vars, and binding

2012-02-17 Thread Brandon Bloom
> > The problem is dealing with with asynchronous code, right? Not capturing / > restoring dynamic bindings. > No, the problem is that there is no mechanism to capture and restore dynamic bindings. This is a shortcoming irrespective of asynchronous code. It just so happens that such a mechani

Re: ClojureScript def, vars, and binding

2012-02-17 Thread David Nolen
On Thu, Feb 16, 2012 at 1:33 PM, Brandon Bloom wrote: > > A robust solution can be implemented via CPS transformation > > Forgive me for my ignorance, but how exactly would a CPS transformation > enable one to capture and restore the current set of dynamic bindings? > The problem is dealing with

Re: ClojureScript def, vars, and binding

2012-02-17 Thread Brandon Bloom
> A robust solution can be implemented via CPS transformation Forgive me for my ignorance, but how exactly would a CPS transformation enable one to capture and restore the current set of dynamic bindings? -- You received this message because you are subscribed to the Google Groups "Clojure" gro

Re: ClojureScript def, vars, and binding

2012-02-16 Thread Laurent PETIT
Envoyé de mon iPhone Le 17 févr. 2012 à 08:24, David Nolen a écrit : On Fri, Feb 17, 2012 at 1:28 AM, Laurent PETIT wrote: > Forgive me if I'm wrong, but global vars / dynamic variables have > essentially more to do with scoping than multithreading, e.g. they existed > in lisps and other langua

Re: ClojureScript def, vars, and binding

2012-02-16 Thread David Nolen
On Fri, Feb 17, 2012 at 1:28 AM, Laurent PETIT wrote: > Forgive me if I'm wrong, but global vars / dynamic variables have > essentially more to do with scoping than multithreading, e.g. they existed > in lisps and other languages way before thread support was added to them. > > So I don't understa

Re: ClojureScript def, vars, and binding

2012-02-16 Thread Cedric Greevey
On Fri, Feb 17, 2012 at 1:28 AM, Laurent PETIT wrote: > Forgive me if I'm wrong, but global vars / dynamic variables have > essentially more to do with scoping than multithreading, e.g. they existed > in lisps and other languages way before thread support was added to them. +1 > So I don't under

Re: ClojureScript def, vars, and binding

2012-02-16 Thread Laurent PETIT
2012/2/16 David Nolen > On Wednesday, February 15, 2012, Brandon Bloom > wrote:. > > > There are analogous constructs in a single-threaded, async-callback > world. In particular, many Javascript libraries have a concept of promises > and futures for managing the async callback speghetti. Like I

Re: ClojureScript def, vars, and binding

2012-02-16 Thread David Nolen
On Wednesday, February 15, 2012, Brandon Bloom wrote:. > There are analogous constructs in a single-threaded, async-callback world. In particular, many Javascript libraries have a concept of promises and futures for managing the async callback speghetti. Like I said, that part of the puzzle needs

Re: ClojureScript def, vars, and binding

2012-02-16 Thread Brandon Bloom
> Given the single-threaded nature of JavaScript I don't see how future-call or agents could be implemented. There are analogous constructs in a single-threaded, async-callback world. In particular, many Javascript libraries have a concept of promises and futures for managing the async callback

Re: ClojureScript def, vars, and binding

2012-02-16 Thread Brandon Bloom
I've updated my fork with IWatchable and validation implemented on Var: https://github.com/brandonbloom/clojurescript/compare/8ba4849e60e5957cdac36ef6946c647e824ca3c8...vars @dnolen I assume I need to wait for my CA to be delivered/approved before I can update that Wiki page? I'd like to add som

Re: ClojureScript def, vars, and binding

2012-02-15 Thread Cedric Greevey
On Wed, Feb 15, 2012 at 5:08 PM, David Nolen wrote: > On Wed, Feb 15, 2012 at 2:09 PM, Brandon Bloom wrote: >> >> ClojureScript doesn't have future-call or agents yet, but if they (or >> similar constructs) are to be implemented correctly, you need the ability to >> save and load a binding frame.

Re: ClojureScript def, vars, and binding

2012-02-15 Thread David Nolen
On Wed, Feb 15, 2012 at 2:09 PM, Brandon Bloom wrote: > ClojureScript doesn't have future-call or agents yet, but if they (or > similar constructs) are to be implemented correctly, you need the ability > to save and load a binding frame. That's what my changes accomplish. > Given the single-thre

Re: ClojureScript def, vars, and binding

2012-02-15 Thread Brandon Bloom
> One problem then is that the work becomes explicit instead of implicit as it is in Clojure: future and agent sends setup the machinery for you. You need the ability to explicitly capture and restore the current thread bindings to implement that implicit machinery. The future macro is implemen

Re: ClojureScript def, vars, and binding

2012-02-15 Thread David Nolen
On Tue, Feb 14, 2012 at 7:17 PM, Brandon Bloom wrote: > > I put your notes here, > > http://dev.clojure.org/**display/design/Dynamic+Binding > > Thanks! > > I don't do anything special for asynchronous code, this simply provides the > primiti

Re: ClojureScript def, vars, and binding

2012-02-15 Thread Brandon Bloom
> I put your notes here, > http://dev.clojure.org/display/design/Dynamic+Binding Thanks! > How are you ensuring that the binding frames are local to a particular > asynchronous block of code and that they are removed when that asynchronous > block of code exits? I don't do anything special for

Re: ClojureScript def, vars, and binding

2012-02-15 Thread Brandon Bloom
As I experiment with this more, I could see non-dynamic Var objects also being useful once IWatchable is implemented on them. Basically, I'd love to send a defn form to the browser during development and have my UI data-bound to both the data AND *the function that rendered it* :-) My dream is

Re: ClojureScript def, vars, and binding

2012-02-14 Thread David Nolen
I put your notes here, http://dev.clojure.org/display/design/Dynamic+Binding How are you ensuring that the binding frames are local to a particular asynchronous block of code and that they are removed when that asynchronous block of code exits? David On Tue, Feb 14, 2012 at 3:41 PM, Brandon Bloo

Re: ClojureScript def, vars, and binding

2012-02-14 Thread Brandon Bloom
Can we continue the conversation on this thread while my CA waits on the USPS? Three things to cover: 1) motivation 2) design 3) impact 1. Why do I want this? Why would anyone want this? - Better parity with JVM Clojure - async Javascript (ie. nearly all Javascript) makes the bind

Re: ClojureScript def, vars, and binding

2012-02-14 Thread David Nolen
This is interesting. However it seems, at least to me, like a big change with too little justification. When you're CA is in, please setup a design document for this line of development - http://dev.clojure.org/display/design/ClojureScript. David On Tue, Feb 14, 2012 at 5:15 AM, Brandon Bloom wr

Re: ClojureScript def, vars, and binding

2012-02-14 Thread Brandon Bloom
To redeem myself for the noob threading mistake, *I've implemented Var and friends in ClojureScript*: https://github.com/brandonbloom/clojurescript/compare/8ba4849e60e5957cdac36ef6946c647e824ca3c8...vars This branch includes (almost) the full set of relevant functionality, but for performance a

Re: ClojureScript def, vars, and binding

2012-02-09 Thread Brandon Bloom
It seems like the missing word from my vocabulary was "conveyance". I've spent a fair bit of time toying with Clojure, ClojureScript, and their respective implementations. It seems like Clojure 1.3 augmented futures and agents with binding-conveyor-fn, clojure.lang.Var/getThreadBindingFrame, an

Re: ClojureScript def, vars, and binding

2012-01-28 Thread Brandon Bloom
D'oh! That's what I get for assuming I remembered the Java Thread API from several years ago Thanks. -- 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 a

Re: ClojureScript def, vars, and binding

2012-01-28 Thread Brandon Bloom
For anyone else stumbling across this thread, I found a lot more information about dynamic binding with respect to asynchronous code in the Clojure Confluence wiki: http://dev.clojure.org/display/design/State%2C+Concurrency%2C+and+Parallelism In particular, the "Asynchronous Events", "Blocking

Re: ClojureScript def, vars, and binding

2012-01-27 Thread Chris Perkins
You should be calling Thread.start in the clojure version, not Thread.run. Your set-timeout is just blocking for a while and then running the passed-in function on the caller's thread. - Chris -- You received this message because you are subscribed to the Google Groups "Clojure" group. To pos

ClojureScript def, vars, and binding

2012-01-27 Thread Brandon Bloom
The ClojureScript wikistates that "the user experience of [binding] is similar to that in Clojure" but my very first experiment produced wildly different results between platforms. Here's a Clojure on the JVM session: use