Fork me on GitHub
#clojurescript
<
2019-04-06
>
Robert Nikander10:04:19

Is this considered a bug, that the cljs compiler's error message for this code is "NullPointerException", pointing at the first line? How about "Methods of a deftype require at least one argument", pointing at the third line?

(deftype Foo [a b]
  Object
  (bar [] 123))

thheller10:04:59

yeah that message could definitely be improved

Robert Nikander12:04:55

Anyone else notice that hot reloading code in figwheel breaks the source maps? (I'm using Safari)

Zachary17:04:34

Hey guys super noob question: trying to use: https://github.com/clj-commons/cljss

:require [cljss.core :refer [defstyles]]
the code I'm getting is saying cljss.core/defstyles does not exist. Does this mean its an issue with my project file?

Zachary17:04:47

this is how i have my dependencies setup: I'm using re-frame

lilactown17:04:53

@zacharycetinic try putting :include-macros true after [defstyles]

lilactown17:04:30

:require [cljss.core :refer [defstyles] :include-macros true]

Zachary17:04:04

awesome worked right away lol. What does include-macros do?

lilactown17:04:37

it includes macros 😄

thheller17:04:12

someone should add the proper :require-macros to cljss so that :include-macros isn't necessary

lilactown17:04:14

macros are written in Clojure, in a separate file usually. you have to tell the CLJS compiler to include them by using :include-macros true or writing :require-macros [cljss.core :refer [defstyles]]

lilactown17:04:00

☝️ what thheller said is also true. a maintainer of that library could add the require to the clojurescript file so that you don’t have to as well

Zachary17:04:53

do macros make compilation slower?

lilactown17:04:50

macros happen at compilation time, so if you have a slow macro it will slow down the compilation

lilactown17:04:07

most macros are pretty simple + fast tho

lilactown17:04:31

shuffling around data structures is something Clojure/JVM are pretty good at

Zachary17:04:09

Thank you @lilactown. Another noob q if you don't mind: right now im running figwheel/re-frame and when i write correct code it works great. However, when i write incorrect code a Java exception is thrown and it seems like I have to restart figwheel. Is there some way around this or am I missing something?

lilactown17:04:30

that sounds strange

lilactown17:04:49

it’s been a long time since I used figwheel, but I remember it’s error messages were quite nice if I had a problem in my ClojureScript code

lilactown17:04:00

it usually popped up a message in my browser

lilactown17:04:18

do you have an example of incorrect code and the exception?

Zachary17:04:02

This was the exception

Zachary17:04:39

The code was just a bunch of reagent template like this i cant seem to recreate the error again though so unsure exactly

lilactown17:04:30

huh yeah that seems super weird

Zachary17:04:21

nbd minor setbacks are better than writing more javascript lmao

thheller17:04:56

it looks like the error triggered when you clicked on the HUD maybe?

thheller17:04:16

looks like its trying to open a file?

Zachary17:04:08

I might've tried to add an 'src' to an image tag but im not sure if that was thrown before or after that error

Zachary17:04:07

I was able to 'control-c' out of the runtime error and the repl showed up again but hot reloading didn't work until i restarted figwheel

lilactown18:04:21

anyone know of an easy to read example of a chrome devtools extension?

lilactown18:04:32

pref written in CLJS but ¯\(ツ)

thheller19:04:36

@lilactown what in particular are you looking for? I toyed with the idea of creating a devtools extension for shadow-cljs a while ago. pretty straightforward to get it setup

lilactown19:04:02

just the bare minimum setup with shadow-cljs compiling my stuff

lilactown19:04:20

I’m running through the chrome extension dev tutorial right now. I’ll see how far that gets me 😄

lilactown19:04:04

😮 there’s a chrome-extension target?? 😄

👍 4
thheller19:04:12

sort of yeah

lilactown19:04:22

what’s it do?

thheller19:04:30

build chrome extensions?

lilactown19:04:52

lol. why would i use it over :browser?

thheller19:04:48

well because its not a typical :browser app 😉

lilactown19:04:39

this is great! thanks! I’ll try it out

lilactown19:04:55

quick question: how do I log things?

thheller19:04:22

(js/console.log ...)?

thheller19:04:01

oh yeah you need to open the devtools on the devtools

lilactown19:04:12

ah yeah. just figured it out