Fork me on GitHub

for ultimate small code size: for the niche case where sci eval strings are known in advance, sci could be used to list all the used vars (somehow?) and emit code to include just those. Related to


not sure how useful that would be, but.. possible


yeah, but in general you don't know and people will come to you on a daily basis to add more, is my experience 😉


but if you have any concrete ideas about this, post away in #357 🙂


having sci optional with dynaload is already a good step. maybe when entering sci for more power and luxury, people don't care as much about bundle size anyway?


Btw, this is pretty cool: this company uses sci to let non-developers write scripts:


I think the option to programmatically create the namespaces.cljc file (to limit access to core vars) is an interesting one. What would happen btw if you right now would include sci.impl.namespaces.cljc in your own project and just edited, ripped out the vars you don't need? I guess that would already work as of now

Patrick Farwick21:07:37

so lvh helped me a bit yesterday getting the binding in specter to work in a single eval statement. (Has to do with how crazy specter is under the hood it seems, select being a macro, select* being a function) (sci/eval-string "(select [:a] {:a 1 :b 2 :c 3})" {:bindings {'select sr/select*}}) So am I correct in the fact that the bindings will work on the eval-string but not in the functions called in the eval string?


A few things: 1. :bindings is really just a shorthand for :namespaces {'user ...} so as soon as namespaces come into play, it's really better to not use :bindings anymore 2. a macro is just a function that takes an s-expression and produces an s-expression which will then in turn be evaluated. you have to bind all the vars that can be references in such resulting s-expression. Use macroexpand to inspect the expansion and you'll hopefully see what I mean 3. (non-macro) functions are just opaque objects, they take input and produce output, but hold on to everything needed to do so (i.e. a closure), so they don't have the problem that macros have


Maybe there is someone who can explain this better than I do, I'm afk now, getting late here

Patrick Farwick22:07:20

No worries, I feel like you said something similar yesterday and maybe it just hasn't totally clicked yet. Sorry if that was frustrating! Have a good night


Not frustrating at all, it's just getting late here