Fork me on GitHub
#clojurescript
<
2017-01-25
>
skelter00:01:55

I tried a different browser just for giggles.

skelter00:01:15

I’m pretty sure I’m expecting the cors headers on the request to fetch http://localhost:3449/index.html

skelter00:01:39

I’ll try wrapping the figwheel server and adding it.

skelter00:01:06

seems like I’m doing something more fundamental incorrectly, though.

skelter00:01:34

or my understanding is fundamentally incorrect

skelter00:01:48

ah. that was it.

skelter00:01:31

My understanding of the focus of cors was upside-down.

skelter00:01:40

I had the concern about injection of references to off-site js stuck in my head and so was expecting the cors headers from figwheel for index.html. That’s not what I should expect. I had to reread cors fundamentals, tweak my api server with cors headers.

laujensen08:01:35

@dnolen great thinking on the infer externs addition, very helpful!

ejelome10:01:42

any good reference for JS interop? e.g. a side-by-side code of implementing stuff with JS and CLJS

thheller12:01:39

@ejelome many of the things listed there are out of date

thheller12:01:35

but will work just fine still 😉

ejelome12:01:01

please someone make a 2.0 😄

ejelome14:01:11

is the cljs linkedin group abandoned? my join request has been pending for quite long

snowell15:01:31

Probably a stupidly easy question here. When I attempt to lein minify-assets or as part of an uberjar task, I get the following error: "java.lang.IllegalArgumentException: No implementation of method: :as-file of protocol: #'http://clojure.java.io/Coercions found for class: java.lang.Character"

snowell15:01:33

Well maybe it’s because lein-asset-minifier says :assets needs to be a map now.

snowell15:01:17

This is what happens when you update some dependencies and try to run a year-old project as-is 😄

ejelome15:01:15

somebody asked me if do they need to know JS to use CLJS, and it's quite difficult to answer 😞

mruzekw15:01:43

Interop might be difficult

emccue15:01:54

I would say no if they are using one of the react bindings, as they abstract pretty well away from js interop

mruzekw16:01:27

There’s still some basic browser stuff that would be helpful to know

akiroz16:01:24

yeah, knowing JS is probably gonna be helpful since all of the runtime API documentation is given in JS.

emccue16:01:03

I've taught my classmates a good amount of clojurescript with a decent amount of success after they took one course that used a lisp.

ejelome16:01:54

without even knowing JS?

ejelome16:01:20

@piotr2b I think it's a bad idea to immediately present cljs with re-frame, something like reagent is more easy to digest for those who want to test the waters

dnolen16:01:53

@ejelome you probably need to know JavaScript basics, but I think that’s about it.

ejelome16:01:40

I agree @dnolen, but it's just that some people think it's possible to literally go full cljs without any sort of js

dnolen16:01:57

hrm yeah I don’t agree with that

dnolen16:01:14

you often want to call into Google Closure Library, and you need to know basic JS

dnolen16:01:31

but if you’re just building toy stuff with reagent

dnolen16:01:40

you can probably get away w/o much JS knowledge

dnolen16:01:43

but not for anything serious

ejelome16:01:03

right, and the problem arises when serious happens

ejelome16:01:12

on the flip side, some people are advising es6/7/8 before diving to cljs, which I think has the same effect or no?

dnolen16:01:11

that claim doesn’t make any sense to me

dnolen16:01:28

you can’t really safely use es6/7/8 (requires source to source compilation)- and regardless what does that have to do with Clojure

ejelome16:01:32

might be because of react?

ejelome16:01:52

but don't also know if it also make sense even for diving to react

dnolen16:01:03

doesn’t make sense to me

dnolen16:01:07

React doesn’t require ES6/7/8

emccue16:01:13

To me it makes sense from the perspective of introducing some functional concepts if you are introducing functional concepts to a JavaScript programmer (if you need a to b comparisons, you could find them easier with es6+)

ejelome16:01:20

alot of misconception really

dnolen16:01:32

I don’t see how ES6 helps with functional concepts

dnolen16:01:39

it doesn’t add anything over JS from 2001

dnolen16:01:43

just sugar

dnolen16:01:25

React also doesn’t help that much with functional concepts

emccue16:01:31

Yeah, but that sugar could ease transition

dnolen16:01:35

most people use React in an imperative way

emccue16:01:19

Like the let statements, getting used to inline functions, generators for lazy seqs

emccue16:01:38

It's all real hypothetical though

dnolen16:01:57

yeah not convinced 🙂

dnolen16:01:47

JS is functional the way that Scala is functional - only if you and your team really want it to be

dnolen16:01:13

to me that’s value proposition of Clojure, the whole ecosystem and idioms are functional by fundamental design

emccue16:01:45

I'll agree with that

mattsfrey16:01:15

does anyone have any experience with tail call optimization? Having a really hard time trying to find if there are any workable solutions out there via trampoline, macro, whatever

mattsfrey16:01:56

I have to read and parse through a very large file line by line and am concerned about stack overflow if I do it functionally using recursion

akiroz16:01:45

@mattsfrey any reason not to use the loop structure?

mattsfrey16:01:21

does loop/recur more or less achieve that?

mattsfrey16:01:32

I'm not familiar with the underpinnings

akiroz16:01:20

That's exactly what the Haskell/Purescript people say to me with Clojure 😂

akiroz16:01:30

@mattsfrey loop is clojure's way of doing recurrsion since the runtime doesn't natively support tail-call optimization

akiroz16:01:50

(call it a workaround if you will....)

joshjones16:01:08

loop is clojure’s way of doing TCO recursion, specifically, forcing it — it will do regular recursion just fine without loop

akiroz16:01:48

oops, mixed up the terms a bit there~

joshjones16:01:00

no worries, i figured @akiroz just wanted to be clear

mattsfrey16:01:11

I suppose thats the answer for now then, I had heard rumors of es6 TCO support at some point but haven't been able to dig up anything fairly modern about that development

dnolen16:01:04

@akiroz yes Haskell/PureScript focus on restraining mutation even more - but I remain unconvinced it matters much

dnolen16:01:57

people keep saying this typed functional thing is going to take off - but when people look for types they just want Java - thus TypeScript’s popularity

emccue16:01:55

That support is browser dependent though, so just use loop/recur and let the compiler figure it out for you

ajitkoti19:01:29

anybody used react-native-maps (https://github.com/airbnb/react-native-maps) with “re-natal" with some success ?

qqq20:01:59

bRepl + eval last sexp is magical

qqq20:01:02

I don't know what else to say

dnolen20:01:07

@qqq give Figwheel a try at some point 🙂

7h3kk1d20:01:42

speaking of figwheel how much work would it take to add readline support. I’m looking for a project to contribute to.

qqq20:01:45

I've tried figwheel before

qqq20:01:56

brepl + eval last sexp is actaully more imprssive imho

anmonteiro20:01:06

@7h3kk1d I normally just use rlwrap

7h3kk1d20:01:31

@anmonteiro That’s what I’ve been using too but it seems to act up sometimes.

7h3kk1d20:01:38

I might just have something messed up locally though.

talexxx21:01:09

How do I escape the double quote character in CLJS?

talexxx21:01:35

”\”” seems to include the backslash when used in a string/replace call

anmonteiro21:01:51

@talexxx can you provide a concrete example?

anmonteiro21:01:00

the backslash is the way to do it normally

tanzoniteblack21:01:52

cljs.user=> (clojure.string/replace "ca\"t" "\"" "n")
==>"cant"

mfikes21:01:16

Need to prefix with a # to your 2nd arg

tanzoniteblack21:01:40

@talexxx can you provide exactly what you're doing? Because just doing "\"" seems to work?

mfikes21:01:40

(regex literal)

talexxx21:01:51

(string/replace "&quot;Foo and bar and things&quot; means" #"(&quot;)" "\"")
"\"Foo and bar and things\" means”

mfikes21:01:52

(clojure.string/replace "ca\"t" #"\"" “n”)

tanzoniteblack21:01:54

@mfikes the # isn't actually required for replace, but it works the same either way

tanzoniteblack21:01:08

(in this case...since I want an exact match and am not doing anything regex-y)

talexxx21:01:14

Actually, that might be fine?

talexxx21:01:30

I assume the output is escaping it so that the result is valid

tanzoniteblack21:01:50

@talexxx yep, if you call println on that, you should see the \" go to "

jr21:01:13

cljs.user=> (goog.string/unescapeEntities "&quot;Foo and bar and things&quot; means")
"\"Foo and bar and things\" means"