I have {:classes {:allow :all}} in my sci opts which works on the jvm, but seems to disappear when compiled under native image. Does {:classes {:allow :all}} behave differently under native image compilation?
Hello, I was working on a project using klipse, and I could use async funcs like go in the editor, now I am trying to switch to an editor based on babashka/sci and I was trying to bind cljs.core.async namespaces to use go and the other functions but it doesn't seem to work? any clue how to achieve that? thanks
@deepbit this question seems a bit out of place in this thread, but the short answer is: don't even try to go there and just expose promesa.core instead
the core.async go macro is a highly complex macro which uses tools.analyzer under the hood, which doesn't work in SCI currently
well, maybe it does now, but it's a big hassle for almost no benefits compared to just using promises
Oops, I'm very sorry I didn't realize I added the message to the thread, my bad!! Thanks for the answer though.
if you're interested in promesa, you can obtain a SCI configuration here: https://github.com/babashka/sci.configs and view the demo here: https://babashka.org/sci.configs/
Thanks that is very useful, I'll give it a go, it might save my project 😄
do you have your previous demo online somewhere?
So I've got an online version using klipse + core async, and in this case I should translate it to SCI + promesa, I think it is possible, it is quite a complicated issue. Basically I am writing a coding framework like https://code.org/minecraft for kids, but instead of using blockly, using written clojure. And I don't want kids to have to deal with async and js execution model, so I use macros to rewrite their code so that if feel synchronous using channels, I guess with promesa I could do similar, need to investigate a bit more. A still work in progress example is in here https://coelias.github.io/juliaworld/ If you type (forward) (forward) it moves forward twice but actually the code is rewritten so that it seem synchronous. The macros are written in the HTML source actually laughcry . I had many issues with Klipse but I managed to get what I wanted working. btw I am feeling bad for keeping adding to this thread
also reminds me of https://2.maria.cloud/ which was ported from self-hosted CLJS to SCI
It doesn't but you also need to provide native image with reflection configuration for it to work
not sure what you meant with "disappear"
I do have the reflection configuration. When I print
(-> @sci-ctx
:env
deref
:raw-classes
keys)
I can see :allow as one of the keys on the JVM, but it's not included when I print it under native image compilationThe error I'm getting is:
clojure.lang.ExceptionInfo: Method close on class java.io.BufferedInputStream not allowed! pod *cider-repl examples/app:192.168.0.182:23456(clj)*:1:1
rather than NoSuchFieldException.do you have a repro
wait
I think I've never used this in native-image since I prefer this message to what graalvm had (an NPE or something) way back
but perhaps this changed
I can repro it, but my setup is very complicated at the moment. I was hoping there was a known thing I was probably doing wrong.
I'll try to dig into it a bit more
probably a bug that I haven't ran across since I've never done this
feel free to post an issue, I can check tomorrow-ish
awesome! Thank you!
I'm not sure why SCI would behave differently under native-image though
I mean, there's not a conditional that checks whether we're on native image and then deletes that key or something
Yea, I've been staring at the code and can't figure it out either.
do you do anything to the ctx yourself outside of the supported sci.core API?
I'm in the process of logging every step along the way to see if I can narrow down where something might happen.
I start the nrepl server, but the :allow key seems to be missing from the environment before I start the server.
you could try to mess a little with sci.impl.main
because that's a fairly small SCI program
which you can compile with script/compile in SCI I think
that's what I would do tomorrow-ish
ah ok cool. I'll give that a try.
picard-facepalm So the problem was that I was calling:
(sci/eval-string (slurp path) @sci-ctx))
instead of
(sci/eval-string* @sci-ctx (slurp path)))
This was overriding the env.Anyway, everything is working now!
aaah ok!