Like this? https://ctford.github.io/klangmeister/
ClojureScript's eval takes a parameter for shared compiler state. On Fri, Sep 23, 2016 at 12:48 PM, Colin Yates <[email protected]> wrote: > How are the rules described? If EDN then I don't see the complication. > If the rules are actually ClojureScript then yeah, OK, but I think you > have bigger problems :-). > > If you are using 'natural language' rules then I strongly recommend > taking a look at Instaparse which works client side as well. If you need > to persist the rules then either persist the source rules (i.e. the > string) or the intermediate transformation tree. > > Maybe I don't understand the workflow, but I am failing to see why you > would want to hardcode the rules into the generated JS rather than have > the JS interpret the EDN rules at runtime? > > -- > Colin Yates > [email protected] > > On Fri, 23 Sep 2016, at 04:17 PM, Simon Brooke wrote: > > This is probably not a problem that affects many people... > > > > As I understand it, I cannot compile a function in ClojureScript and have > > it integrated into the current ClojureScript compiled image (if I'm > > wrong, please tell me so. I'd really, really like to be wrong). > > > > I have a web app which allows people to write rules for a cellular > > automaton, and watch them run (you can see it here > > http://www.journeyman.cc/microworld/ if you're interested). The problem > > is that all the computation happens server side, so it doesn't scale. I > > need to move as much as possible of the computation to client side. > > > > A key feature of the application is that users can edit the rules - in > > fact, they're encouraged to. That's what it's about. When the rules are > > edited they're compiled into Clojure functions, which then run. > > > > I can move all the function of the application client side except (at > > this stage) compiling the rules. So I'm envisaging a version of the app > > which, when the user edits the rules, the parsing happens client side and > > any parser errors are shown to the user immediately, but when they decide > > to commit their changes, the generated Clojure text is sent back to the > > server, where it is compiled with the rest of the CLJC code into a new > > app.js JavaScript image and served back to the client. The state of the > > world can be cached in HTML5 local storage while this is being done. > > > > The problem I see is this: if Alice and Bob are both using the system at > > the same time, both edit rules, I don't want Alice getting an image with > > Bob's rules in it (or vice versa). So I'm going to need to compile > > separate copies of app.js for each client that connects, and serve the > > right one to the right client. > > > > Has anyone else tried anything like this? Did it work? What were the > > problems? > > > > Cheers > > > > Simon > > > > -- > > Note that posts from new members are moderated - please be patient with > > your first post. > > --- > > You received this message because you are subscribed to the Google Groups > > "ClojureScript" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to [email protected]. > > To post to this group, send email to [email protected]. > > Visit this group at https://groups.google.com/group/clojurescript. > > -- > Note that posts from new members are moderated - please be patient with > your first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/clojurescript. > -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/clojurescript.
