Fork me on GitHub
#clojurescript
<
2016-10-19
>
noprompt04:10:02

why is cljs.core/char? defined in terms of goog.string.isUnicodeChar instead of a string of length 1? (char? (char 0x00)) is true in clojure but not in clojurescript. (i can thank test.check for spotting this.) it'd be nice to know the rational behind this because, frankly, i don't understand it.

daveliepmann11:10:45

@noprompt is 0x00 a Unicode character? I know that (char 0x00) says it is, but is it really?

iamyemeth13:10:16

does anyone know if foreign-libs are supposed to be loaded in the order they are required

dnolen13:10:28

@noprompt the answer is simple, char is host-y there’s no need to replicate stuff like that

iamyemeth13:10:59

I’ve currently added immutable.js and draft.js (which depends on immutable.js) but draft.js always seems to load first

dnolen13:10:48

@occamin load order is about dependencies between nses

iamyemeth13:10:16

they are both only loaded in the same namespace with immutable.js first

dnolen13:10:26

if draft.js depends on immutable.js you must express this in the :requires part of the :foreign-libs entry

iamyemeth13:10:07

ah awesome, thanks

noprompt13:10:56

@dnolen that still doesn't answer my original question though. why is defined in terms of that function? what makes that the definition of a char and not a string of length one. i'm not trying to be contentious; just trying to get a better answer.

dnolen13:10:37

@noprompt it does answer your question

dnolen13:10:57

char in ClojureScript doesn’t do what char in Clojure does

dnolen13:10:09

because there are no chars in JavaScript

dnolen13:10:45

so involving it in your question doesn’t make much sense

dnolen13:10:11

wrt. char?

noprompt13:10:06

@dnolen i think the "it's hosty" answer might suffice as an answer for other topics but i tend to disagree in this case. the null character is a character. the definition of char? as it applies to javascript is written to say, no, it's not. i'm only asking how this definition was derived. it just seems arbitrary. saying "it's hosty" avoids spelling out the rational.

dnolen13:10:06

you re-formulate your confusion into an actual problem

dnolen13:10:12

(char 0x00) is meaningless

dnolen13:10:24

in ClojureScript

noprompt13:10:29

the null character doesn't exist in javascript?

dnolen13:10:26

no your expecation that char can be used to coerce numbers and for the behavior to match Clojure is just unrealistic

dnolen13:10:42

your expecation that char? can match Clojure’s behavior is unrealistic

dnolen14:10:18

both those things exist simply to make initial ports simpler - nothing more

dnolen14:10:32

their implementation do not and cannot match Clojure’s and it’s just not important

dnolen14:10:22

now if you stop obsessing about this stuff and instead asked a simpler question maybe we could make progress 🙂

dnolen14:10:34

char? cannot match the null character

dnolen14:10:48

that’s an actual problem

dnolen14:10:58

if that’s all you were trying to say - then OK

noprompt14:10:53

no, my confusion is with char? alone. char matters little in this discussion i could have easily replaced the original example code with (char? (.fromCharCode js/String 0)). again, my question is why char? is written in terms of a function that excludes the null character? i really don't care whether or not there is parity with clojure. i found this surprising.

dnolen14:10:59

@noprompt there’s no reason - it’s a bug now that I actually understand what your expectations are

dnolen14:10:18

but this is problem with how you constructed your example - it just makes it harder to understand what your issue is

dnolen14:10:31

also mentioning implementation just makes the issue confusing

dnolen14:10:35

who cares how any of this is implemented

noprompt14:10:17

@dnolen well, david, that's how the real underlying questions are uncovered. 🙂 you don't just start from the right place from the beginning.

dnolen14:10:34

yes - open a JIRA ticket & submit a patch a patch so that char? can match the null string

dnolen14:10:58

@noprompt so it seems a big reason that this slipped under the radar is that there weren’t any tests for char? which is unfortunate

dnolen14:10:28

so a patch should include tests, also the issue is wider than the null string and the tests need to reflect that

noprompt14:10:00

@dnolen it's been awhile since i worked in the code base. is c.test.check involved?

noprompt14:10:11

that's how i uncovered this.

anmonteiro14:10:08

@noprompt I’ve introduced a dependency on test.check in the ClojureScript codebase for some test runs in a recent patch, so you have that available to write tests for your patch 🙂

anmonteiro14:10:20

there are no generative tests for cljs.core yet, though, so this is an excellent opportunity to write some!

noprompt14:10:14

@anmonteiro noyce! thanks for the tip.

baptiste-from-paris15:10:25

hello guys, I might need some help as I can’t connect cider to fighwheel and I can’t understand why. I have a cider-repl-set-ns needs a clojurescript repl

baptiste-from-paris15:10:33

I use lein figwheel template

baptiste-from-paris15:10:46

which should be ready

baptiste-from-paris15:10:57

anyone ever had something like that ?

amirrajan16:10:08

Here is a snippet of project.clj:

:plugins [[lein-figwheel "0.5.0-1"]
            [lein-cljsbuild "1.1.3"]]
  :source-paths ["src"]
  :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}
  :profiles {:dev {:dependencies [[com.cemerick/piggieback "0.2.1"]
                                  [figwheel-sidecar "0.5.2"]]
                   :source-paths ["cljs_src" "dev"]}}

jrheard16:10:14

sulbabaur immediately killed my chipu and my mom called me worthless :’(

amirrajan16:10:41

seems accurate.

baptiste-from-paris16:10:59

ahha @amirrajan thx but I already had that

baptiste-from-paris16:10:05

I just found it now though

baptiste-from-paris16:10:29

for an obscure reason, my emacs does not launch (do (use 'figwheel-sidecar.repl-api) (start-figwheel!) (cljs-repl)) from me init.el

amirrajan16:10:32

As far as starting figwheel up, I use cider-jack-in-clojurescript

dnolen17:10:01

@noprompt I went ahead and fixed the issue and reverted char? to the old implementation

dnolen17:10:23

I only did unit tests since I want to cut a release now - feel free to add generative tests via an enhancement patch

johanatan17:10:51

@dnolen hey, this isn't a clojurescript question but I bet you'd know the answer to it right away (since you've done a lot of core.logic): "is there a way to AND a dynamically generated list of constraints? [Cannot apply all or run as they are macros]". Feel free to ignore if you have to think about it.

noprompt18:10:03

@dnolen the protocol is the same for adding tests? just open a JIRA ticket?

noprompt18:10:46

@dnolen i've been out of the clojurescript loop for a long time. i miss helping with the project when and where i can.

dnolen18:10:50

@johanatan yes, you can reduce your goals with bind

dnolen18:10:09

@noprompt glad to have any help whatsoever - that said, contributions are coming strong & fast these days 🙂

johanatan18:10:13

@dnolen do you mean bind* ?

dnolen18:10:38

@johanatan yes the non-macro thing

noprompt18:10:49

i've noticed! i was very happy to see the new about solid 1.x.x releases when the news came out. when my kids were born and i started having less time i decided to use the free time i have had to get better acquainted with computer science and just kind of disappeared into the fog of research.

johanatan18:10:52

bind* is a macro and I couldn't find any plain bind

johanatan18:10:17

[except as a protocol method]

noprompt18:10:31

@dnolen you were a big positive influence for me with respect to that.

noprompt18:10:05

it's paid off a lot. i guess that's my way of saying thanks for the inspiration!

dnolen18:10:11

@johanatan so write a function that invokes bind yourself

dnolen18:10:19

still I recall there being a case where I did this somewhere

johanatan18:10:32

would be great if you can remember where. i'm not sure what the target of bind would be: are you saying that my pre-existing constraints should already implement the IBind protocol and thus the bind method?

johanatan18:10:41

[if so, i can definitely swing that without an example]

dnolen18:10:15

@johanatan sorry can’t help you further on this one right now

johanatan18:10:33

no worries. thx for the pointers

johanatan18:10:51

to answer my own question: yes, existing constraints support the IBind protocol:

slipstream.core=> (clojure.core.logic.protocols/bind (parent :bob :jon) (parent :jane :suzy))
#object[clojure.core.logic$eval1901$fn__1902$_inc__1903 0x7fe16741 "clojure.core.logic$eval1901$fn__1902$_inc__1903@7fe16741"]
slipstream.core=> 

witek20:10:17

Hi. I am trying out reagent with figwheel and devcards. What is the best place to put my devcards? In the same file and namespace where my components are? Or where my tests are?

bhagany20:10:47

@witek I usually put them in a different source directory, so that I can easily put them in a separate build

jrheard20:10:41

(i’m glad you asked, witek, i’ve wondered the same thing myself)

witek20:10:06

@bhagany But you use the same namespace? From different files?

bhagany20:10:26

no, they’re separate namespaces

witek20:10:58

I see, devcards there...

bhagany20:10:03

@witek also, just fyi, there’s #devcards

bhagany20:10:29

I got some good help in there

bhagany20:10:15

I just tracked down a bug in my code that was due to int behaving in a way I didn’t expect:

cljs.user> (int 15201360000.000002)
-1978509184
This seems odd to me - it happens because int calls bit-or on its argument - but I assume this is one of those host-y things, so I’m not trying to argue about implementation. However, I think the docstrings are misleading for these functions: https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/core.cljs#L2639-L2657 - int doesn’t really just strip off decimal places - the docstring for unchecked-int is identical to int, but it behaves differently (it returns what I’d expect for my input above) - the docstrings for long and unchecked-long say they are identical to int, but instead are identical to unchecked-int. Is this the sort of thing I should file a jira ticket for?

dnolen20:10:20

@bhagany this conversation is more appropriate for #cljs-dev

bhagany20:10:39

okay, I’ll move it there, thanks

chris-andrews20:10:02

so ClojureScript 1.9.293 seems to be loading commonjs modules that have the umd pattern now

borkdude21:10:14

Congrats on the new cljs!

borkdude21:10:37

I was reading the announcement and found a reference to this mysterious commit again: http://dev.clojure.org/jira/browse/CLJS-1809 Wonder what that’s about 🙂

anmonteiro21:10:08

just feature parity w/ Clojure

borkdude21:10:43

yes, that commit. I tweeted about it some days ago 😛 https://twitter.com/borkdude/status/787377977302679556?lang=en

borkdude21:10:00

but I still don’t know the idea behind that commit

anmonteiro21:10:12

I suppose most of use don’t 🙂

borkdude21:10:36

maybe it’s spec related

Alex Miller (Clojure team)21:10:10

not anything big either, just a little transducer thing

borkdude21:10:11

suspense is killing me @alexmiller

Alex Miller (Clojure team)21:10:28

just imagine Rich out in the garage tinkering :)

anmonteiro21:10:42

@alexmiller I suppose clojure.core.async/transduce is also related

Alex Miller (Clojure team)21:10:09

might have been spurred by the same thoughts

borkdude21:10:46

Some months ago I thought: there must be some arity we are overseeing where Rich can fit in a feature that will blow most of us away. I’ll be watching github...

Alex Miller (Clojure team)21:10:20

I think we’ve spent more time talking about what to call it than he took to write it

borkdude21:10:26

@alexmiller don’t spoil it now

Alex Miller (Clojure team)21:10:36

I don’t know the final name so can’t :)

Alex Miller (Clojure team)21:10:01

I don’t believe anything till it’s a commit :)

borkdude21:10:42

@alexmiller Actually the feature turned out to be spec, but it didn’t fit inside a secret arity somewhere. Still blown away. 😉

Alex Miller (Clojure team)21:10:14

I’d still love to expand vec and set to take a transducer

anmonteiro21:10:54

@alexmiller what’s your rationale for vec? doesn’t (into [] xform coll) cut it?

Alex Miller (Clojure team)21:10:56

for vectors in particular, you could make this more efficient than the current impl by directly building the owning root array

anmonteiro21:10:24

oh you just explained it

Alex Miller (Clojure team)21:10:33

some of that is in LazilyPersistentVector, but this would incur effectively no overhead to leverage that perf trick

Alex Miller (Clojure team)21:10:59

basically drop the incoming values directly into an array and then embed that inside the root vector node at the point where you meet the threshold

dnolen21:10:40

@chris-andrews Maria’s patch was probably further enhanced

chris-andrews21:10:24

@dnolen Yeah, it’s really cool. I’m going to try making a couple boot tasks that make it easier to take advantage of some of this