Fork me on GitHub
#clojurescript
<
2023-04-17
>
scknkkrer10:04:54

Has anyone knows about the current status of any modern game engine wrapper for Clojurescript?

borkdude18:04:49

Is it possible to detect in general (shadow-cljs / vanilla CLJS) if the compiler is running in advanced mode?

jpmonettas18:04:56

I think you can do it like this :

(ns org.foo.macros
  (:require [cljs.env :as env]))

(defmacro m [x]
  (case (get-in  @env/*compiler* [:options :optimizations])
    :advanced `(js/console.log "In advanced")
    `(js/console.log "Not advanced")))

jpmonettas18:04:50

so basically use a macro, and at macroexpansion time emit different code

borkdude18:04:50

cool. does that also work for shadow?

borkdude18:04:03

yes, I was going for a macro

jpmonettas18:04:03

I only tested it on shadow he

thheller19:04:18

could go with a goog-define?

borkdude19:04:07

this is more for a library than an app

borkdude20:04:48

it's not actually that important, but I think I could avoid some work in non-production builds

souenzzo23:04:33

please allow the user to choose what to include or not, via properties example: guardrails https://github.com/fulcrologic/guardrails#clojurescript-considerations

Chase23:04:36

what is the cljs equivelant to (ns-unalias *ns* 'foo) ? I can't seem to find a good answer online at the moment

thheller06:04:32

there isn't one. CLJS doesn't have actual vars at runtime, so doing this does nothing useful.

Chase12:04:56

Hmmm. I had gotten myself into a situation where I was using re-frame and reitit.frontend and had aliased :require [re-frame.core :as rf] and had decided to just refer in what I needed there and use the rf alias for reitit.frontend like their docs. Was not able to do so because of an alias error, just like I would get in Clojure. I had to work around that as it couldn't be rectified. Wasn't a big deal at all, true, but it would've been a little useful haha