Fork me on GitHub

I've also used Works fine for simple use cases. More complicated yaml files (e.g. with custom tags) are more troublesome if i remember correctly. I've never been able to convert cloudformation yaml to json and edn. I still use online converters for this 🙈


copied it in the issue


@borkdude What do you think about adding a missing symbol resolver to Sci? I have a specific use case for this. Now I have a hack:

(let [external-definitions '{a 1 b/x 2 c 5 d 9}
      resolver (fn [sym]
                 (get external-definitions sym))
      code "(+ a b/x c d)"
  (loop [assignments {}]        
    (let [[state result] (try
                           [:ok (sci/eval-string code {:bindings assignments})]

                           (catch clojure.lang.ExceptionInfo e
                             (if-let [sym (second (re-find  #"Could not resolve symbol: (.*) \[" (ex-message e) ))]
                               (let [missing (symbol sym)]
                                 (if-let [assignment (resolver missing)]
                                   [:retry (assoc assignments missing assignment)]
                                   (throw e)))
                               (throw e))))]
      (case state
        :ok result
        :retry (recur result)))))


why exactly do you need this?


why don't you pass the external-definitions in as bindings?


I would like Sci to tell me what I need, but i'll explain


Ok it is a long story, but here it goes. I'm writing a aws lambda function in clojure. I'm testing it locally in my repl. However it needs to run in sci. Sci needs the definition of the code. In my case it is 5 functions I need to paste or somehow get as a string in Sci. If there would be a resolver I could do this a bit less manually (i'm not actually doing it manually, but it's uggly code like above)


Does it make sense?


Otherwise i'll just stick with my hack and show my use case when it is done


I don't get it since your resolver does the same as sci would do when you would pass those as bindings


you might have a good use case, but I'm not getting it yet


note that the resolve function might not work well with DCE of graalvm and CLJS advanced, so it's bit of a risk to let users do it in arbitrary ways


I'll show my use case later. I can work around it


Hi! Trying to include Cognitect's aws-api as built-in in bb fails with > AnalysisGraphBuilderPhase:$BytecodeParserError: Unsupported method java.lang.ClassLoader.defineClass(String, byte[], int, int) is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class > at parsing clojure.lang.DynamicClassLoader.defineClass( > at > at$SharedBytecodeParser.throwParserError( > at Is there any way to fix that? Thank you!


can you track it down to a specific part in aws-api which causes this?


one other problematic part might be due to locking, so you would have to patch that as well


I think it would make sense to fork this lib and simplify parts around resolve and locking, until it works with graalvm


Thanks a lot for looking into it! So far, GraalVM is dark magic to me so I will likely take the cljs route for now.


it is pretty dark magic


Graal compiles make you realize the luxury of living on the "no you don't need to care what version of glibc / zlib / esoteric-thing happens to be installed on your build machine" JVM


@holyjak I've ported and to cljs. I think those namespaces by itself would also compile to GraalVM. This gives you the signing parts of AWS requests. To do a proper request you still need to do some manual work. So if you have other options I would advice against trying to this via GraalVM


If you want to try anyway, i would remove all the http client stuff and see if it compiles. If it does than you just need to use a different http client. E.g. ring-curl works with GraalVM


clj-http-lite also works with graalvm and bb


but that might not have the things you need security wise? don't know


the ring-curl was chosen because of the SSL issue when you compile it on github actions


I think if you compile it locally clj-http-lite etc would be fine