Fork me on GitHub

when writing anonymous function, is there a way to emit this without additional assignment? (like no var this$ = this) The library I'm using (GPU.js) takes a JS function and transpiles it to a shader and it only takes the exact form of this.thread.x not this$.thread.x . so to speak, the JS AST works as a DSL in GPU.js so accessing properties should be verbatim sometimes..


@namenu unfortunately no. this also doesn't sound like a good idea when using :advanced compilation since it might heavily modify what your code looks like


Couldn't you do it with js*?


that still goes through advanced ...


yes, I was wondering if there's a optimization safe way to do this. (it works ok with *js on dev)


You probably can write a regular JS file and add /** @nocompile */ at the very top of it, and use exports from CLJS in there.


thanks! I should move all my kernel functions outside. 🙂

👍 4

is there no way to pre-generate the shader from the JS? I mean it sounds like a terrible idea to me to do that at runtime?


yes there is. but the purpose of GPU.js is abstracting out GLSL and direct use of gluing gl functions. for people like me who don't know the GLSL syntax but still want to use GPU for general purpose, it was kind of option I guess..?


yes I get that. seems like a neat idea. I just don't get the part of doing it at runtime. that means it requires parsing JS at runtime, meaning you need to embed a JS parser/analyzer etc


if you just do it beforehand you can still write plain JS but the final code only contains the already generated shader


no JS parser etc required at runtime ... equals smaller file sizes, faster startup, etc


but no clue what that library does so it may just be for technical reasons they don't do it


I got your point. Then I found it also providing export/import of precompiled JSON, although have some steps to be done at runtime. thanks, now I have +1 way to get through this!


goodday, any advice on how to proceed to integrate a facebook login on a clojurescript app?