Fork me on GitHub
#clojurescript
<
2024-08-04
>
Lidor Cohen10:08:17

Hi I want to (resolve (symbol "")) in cljs. Am I missing something? is there a way to make it work?

p-himik10:08:04

In CLJS, resolve is a macro that accepts a quoted symbol. I.e. something like (resolve 'xxx) or (resolve (quote xxx)).

p-himik10:08:16

Depending on what you're trying to achieve, there might be other solutions.

Lidor Cohen10:08:23

I'm trying to receive a string of a fully-qualified symbol and resolve it at runtime. If I understand correctly the issue here is "at runtime". I'm guessing the reason resolve is a macro is to resolve the symbol at compile time...

1
p-himik11:08:37

Indeed. An alternative would be to have an explicit registry of all symbols that are intended to be resolvable.

🙏 1
marrs17:08:07

Is there a guide on how to just embed CLJS in an existing web page? It seems in the getting started guide like I'm expected to generate the entire HTML in CLJS, which is massive overkill for what I'm looking for.

p-himik17:08:26

> I'm expected to generate the entire HTML in CLJS That's not the case at all. The way you use CLJS is exactly the same way you'd use e.g. TS or plain JS that requires some preprocessing. There's a build step, and then there's execution step. The latter can be done via embedding on a web page or via some other means. And the build step can also be omitted with e.g. https://github.com/babashka/scittle

marrs19:08:43

Thanks, scittle looks like it could be pretty useful in its own right

marrs20:08:44

And I had an error in my code. All working now, thanks

👍 1
marrs11:08:01

@UFTRLDZEW thanks, this author gets it! 🙂 I'll give this one a close read