-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Squint remove ":" for keyword value #516
Comments
Keywords are just strings in squint, this is a design decision. In cherry
there are real keywords though
https://www.michielborkent.nl
https://www.eetvoorjeleven.nu
…On Sun, 28 Apr 2024 at 07:09, kangaroolab ***@***.***> wrote:
*version*
[ Please specify which version of squint you're using. You can find this
in package.json under "squint-cljs"
latest version 0.6.95
*problem*
[ Please provide a short and to the point description of the problem ]
for (:a {:a :b}), Squint parse and return as:
squint_core.pr_str(squint_core.get(({ "a": "b" }), "a"));, where ":" is
removed from the keyword value
*repro*
[ Please provide a minimal and complete reproduction of the problem,
preferably something which can be run with Node.js without dependencies. ]
see above
*expected behavior*
[ What is the behavior you expected to see from squint? ]
should keep ":" for keyword value and return ":b". this works fine with
scittle
—
Reply to this email directly, view it on GitHub
<#516>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACFSBTOC5KZIPIUFMG2DH3Y7SAAZAVCNFSM6AAAAABG4VTFIWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI3DOMZUGU2TSMI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Thanks for your feedback. Very helpful. I am trying to put together a browser only env where I can edit and run Clojure code in browser with some Clojure core modules like core/string/set etc. Better if I could use web worker to compile and executive Clojure code. A few options I tried:
|
What is your use case for scittle without running it in a browser? I think I could make that DOM stuff optional |
it is running in browser but I am trying to make it run in web worker (a separate thread). here is the use case (what I am trying to put up): right now, I have this up/running with Scittle as part of html page. I am hoping to see if there is option to move Scittle into a web worker where the REPL will happen while keeping the html page for user interaction only. hope this clarifies. to remove DOM reference in Scittle, is it just to remove eval_script_tag from the core? |
I think the function itself doesn't really hurt since you can refer to undefined stuff in JS functions, but there is an event which calls that function here: You can opt out of that behavior by calling this function: |
thanks... should I remove following from core.cljs? (js/document.addEventListener it (the compiled js) will be parsed/invoked during import (in web worker) even if I can disable auto-eval. what should be the edn to compile scittle? or package.json works even if it is for NPM. sorry I asked question about scittle here...please advise if I should post this under scittle on github. thanks again for offering scittle. it works like a charm and I love it. |
JavaScript doesn't care about that. E.g.:
As long as you don't call But in scittle's case For now you can work around it like this: Define a fake
When I then load scittle in Node.js, it works:
|
Actually I fixed it already now in babashka/scittle#77 - I'll publish a new scittle version |
Here is a scittle example with a webworker: |
thanks...but I tried your web worker example in jsfiddle but it doesn't seem working. to test it quickly with import, I tried following in html:
It shows error Uncaught TypeError: Cannot read properties of undefined (reading 'eval_string'). If I tried the same with squint, it works fine. Is scittle compiled as module or what are part of the exports? |
See the docs here: You just use a normal script tag without I used |
Also, if you don't know what the exports are you can just do this:
and then find out how it's structured. |
here is the comparison between squint and scittle:
and the results are below: Module {…} here is the code to start web worker (I used script tag above with type = "module" to test the module out before I put the code in web worker accordingly), which requires import module vs common JS. note: classic doesn't work with web worker as the worker will need to import other javascript module
it didn't seem there are exports with scittle |
As I already said, don't use scittle itself as a module in a script tag, but this does work: <html>
<script type="module">
import * as _ from 'https://cdn.jsdelivr.net/npm/scittle@0.6.17/dist/scittle.js';
console.log(scittle.core.eval_string("(+ 1 2 3)"));
</script>
</html> The |
it works now both in browser and web worker....thanks a lot! |
version
[ Please specify which version of squint you're using. You can find this in
package.json
under"squint-cljs"
latest version 0.6.95
problem
[ Please provide a short and to the point description of the problem ]
for (:a {:a :b}), Squint parse and return as: squint_core.pr_str(squint_core.get(({ "a": "b" }), "a"));, where ":" is removed from the keyword value
repro
[ Please provide a minimal and complete reproduction of the problem, preferably something which can be run with Node.js without dependencies. ]
see above
expected behavior
[ What is the behavior you expected to see from squint? ]
should keep ":" for keyword value and return ":b". this works fine with scittle
The text was updated successfully, but these errors were encountered: