Fork me on GitHub
#clojurescript
<
2016-09-21
>
dnolen00:09:03

users are just going to write (:require [clojure.test :as test :refer […]) and be done with it

dnolen00:09:34

@spieden lein deps :tree to make sure you don’t have some weird dep conflicts

dnolen00:09:47

(i.e. something is pulling in an older version of ClojureScript)

spieden00:09:06

@dnolen i did indeed, just now got it sorted

spieden00:09:32

then went and read about project jigsaw only to learn they aren’t doing anything for version conflicts in JVM land =\

dnolen00:09:31

@spieden we leave the task of automatic conflict resolution to some future alien civilization

cfleming00:09:26

@dnolen Ok, thanks - yes, I assumed that was the case. I’ll implement that.

lxsameer12:09:12

does ns-resolve exists in clojurescript ?

dnolen12:09:46

@lxsameer nope, namespaces are not reified at all - none of that functionality exists

dnolen12:09:22

vars also only exist in a highly limited fashion and it’s best to have no expectations

dnolen12:09:53

(the story for bootstrapped is different, but I’m assuming you’re not asking about that)

lxsameer12:09:00

@dnolen bootstrapped clojurescript is a different variant of clojurescript, right ?

dnolen12:09:34

it’s a provided self-hosted option for people who don’t care about greatly increased code size

dnolen12:09:48

and losing advanced compilation entirely

jannis13:09:21

This may sound stupid but is defmacro in ClojureScript a thing now? I'm looking at spec.cljc in the ClojureScript repo and it has defmacro without a surrounding reader conditional. How does that work?

anmonteiro14:09:32

@jannis it’s meant for self-hosted CLJS

anmonteiro14:09:23

there are some other posts of interest re: macros in that blog too

dnolen14:09:29

@jannis not a thing, and isn’t going to be

eyelidlessness14:09:20

is it expected when a let binding name shadows a js global, the global becomes inaccessible with js/...?

eyelidlessness14:09:55

i can see from the generated source why it happens, but it surprised me

darwin14:09:29

@eyelidlessness that is not expected, I would expect js/ to work regardless

darwin14:09:30

to me “js/“ is a view to “Javascript world”, not just a syntactic sugar

eyelidlessness14:09:08

(defn simple-repro []
  (let [location (str js/location.pathname)]
    location))
calling that throws TypeError: Cannot read property 'pathname' of undefined

darwin14:09:36

aha, I’m sorry I misunderstood

darwin14:09:15

that looks like a bug to me 🙂

eyelidlessness14:09:15

though i'd expect it would not throw with advanced compilation

eyelidlessness14:09:50

(this is with whitespace optimization only)

dnolen15:09:58

@eyelidlessness not sure what you would expect

dnolen15:09:12

since that’s just JS scoping rules

eyelidlessness15:09:43

like i said, i understood why it happened.

dnolen15:09:50

that’s how it works

eyelidlessness15:09:12

like i said, i understood why it happened.

dnolen15:09:43

more specifically js isn’t a namespace

dnolen15:09:04

so there’s no simple way for it to work

pesterhazy15:09:44

it's at least surprising; I also didn't realize that js/window may fail in a let

dnolen15:09:53

now you know 🙂

dnolen15:09:17

js works a certain way and it’s not going to change

dnolen15:09:33

it’s probably simple to warn about the mistake though

dnolen15:09:40

and anyone can submit a patch for that

pesterhazy15:09:54

a warning would go 95% of the way of removing the surprise yes!

dnolen15:09:09

a relatively simple change for somebody who wants to contribute

dnolen15:09:19

I’m not going to spend any time on it except reviewing a patch

eyelidlessness15:09:44

makes sense. i may take a look at it.

pesterhazy15:09:39

agree makese sense

dnolen15:09:13

if you want to get involved jump on #cljs-dev and ask questions

dnolen15:09:36

a few people understand how warnings works, and how we could check js/foo conflict with a local

eyelidlessness15:09:19

i'm gonna take some time looking through the codebase and see if i can't grok how to do it, before i ask any questions.

dnolen15:09:11

@pesterhazy yes it’s the same problem - but wasn’t interested in the proposed solution

dnolen15:09:15

a warning suffices

eyelidlessness15:09:37

i agree. i would prefer less name mangling, not more 🙂

dnolen15:09:53

cljs.analyzer/resolve-var is probably the place for the fix

dnolen15:09:15

some care must be taken to handle cases like js/window.location

dnolen15:09:56

@eyelidlessness @pesterhazy feel free to open a minor enhancement ticket in JIRA

dnolen15:09:15

something like a “warning for shadowed js/foo"

dnolen15:09:03

@pesterhazy yes but unrelated to this enhancement

eyelidlessness15:09:08

one minute (eternity) while i relearn how to use jira

pesterhazy15:09:56

wouldn't throwing an error be even better than a warning? Is there any situation where you want to use js/location to refer to a let binding?

pesterhazy15:09:05

just a thought

eyelidlessness15:09:18

makes sense to me.

dnolen15:09:41

almost all of them are trivial clojure.spec stuff

dnolen16:09:56

plus warnings are customizable

dnolen16:09:15

if you want your own build to fail - go for it

hlolli21:09:45

@pat doc is in clojure.repl namespace. So either (use 'clojure.repl) and (doc map) or (clojure.repl/map) ps. use wont work with cljs, but if you are using cider, then most likely you have clj repl at hand.

pat21:09:52

@hlolli that pin was my clumsy thumbs scrolling on the train, my apologies for the noise

createmo21:09:46

anyone would like to share if they’ve done projects involving arduino/raspberry-pi with clojurescript? I want to gauge what the possibilities are