Fork me on GitHub
#clojurescript
<
2015-07-08
>
jwm00:07:44

I didn’t think a lot of people used node.js as a backend

samueldev00:07:31

I have used node as a backend for 3 years now. I still dig it

dnolen00:07:53

@jwm: Clojure programmers don’t very often, one place where it makes some sense is AWS Lambda where the startup time might be an advantage over the JVM.

jwm00:07:13

my friend just compared startup time of ruby’s irb and lein repl hehe

dnolen02:07:47

@jwm doesn't make much sense.

escherize07:07:41

Hi I'll be doing some streaming of a graph visualizer with cljs+emacs at http://www.twitch.tv/escherize/ in a minute or two

rui.yang07:07:01

@jrychter: nice website. wonder what's your experience of dealing with css in writing a component?

jrychter07:07:33

@rui.yang: Semantic UI does 99% of that for me. For customizations, I tend to use their theming system (although the npm/gulp build tools are terrible). I try to stick to out-of-the box look as much as I can, to cut costs.

rui.yang07:07:20

@jrychter: so basically when writing a component, you'll have to choose the css framework. and the component will be tight to the css framework.

jrychter07:07:29

@rui.yang: yes, I write everything with one CSS framework in mind. I can't see another way, you'd end up with components trying to be everything to everyone. Plus, I rather like how the resulting code looks like:

[:div.required.field
      [:label "Login"]
      [:div.ui.icon.input
       (ui/autofocused-element :input {:type "text" :value (:login @local-state)
                                       :autoCapitalize "off"

jrychter07:07:46

@rui.yang: I used to try to write universal libraries all the time. Now I focus on apps, and when you do that (on a schedule), you tend to choose more practical solutions.

acron08:07:47

@dnolen: just saw the om.next video - fabulous talk, congrats

grounded_sage12:07:20

@dnolen: Had been hanging to see the video on Om Next. I'm currently going through Living Clojure and feel like I am picking up Clojure well and thoroughly enjoy it and the community. I'd love to start playing with Om Next as soon as it is released is there an approximate ETA for it or is that yet to be announced?

dnolen12:07:31

@grounded_sage: maybe by end of summer? But not sure. There’s no rush on my end. There’s a lot of little design details to get right.

grounded_sage12:07:38

I'm also feeling like I am partially at a crossroads. I have purchased some Meteor books and dived into Meteor/JS as my first introduction to programming but upon diving further into Clojure I feel like this is the space to be. I intended on using Meteor to build my start-up, perhaps doing some hybrid stuff, but with DDP and Mongo I'm unsure whether I will end up with more of a headache. Has anyone built a forum with Clojure/Script? as that is essentially half of what my MVP will need and Telescope is an ok implementation.

grounded_sage12:07:35

@dnolen: awesome thanks! I'm just going to helping my partner build her law firm using Clojure for a while to get some experience under my belt with it. Perhaps I will stick with basic ClojureScript for the front end as I wait for Om Next to come out before doing more full on things for her business. Then after that I plan to build my start-up. So will be some time away simple_smile

dnolen12:07:47

@grounded_sage: not aware of anyone specifically building a forum with Clojure(Script)

dnolen12:07:15

@grounded_sage: people also love Reagent, it quite nice and does more out of the box

dnolen12:07:34

I’m curious to see what the other React bindings end up doing around the Relay/Falcor ideas

grounded_sage12:07:38

Yea I'm pretty excited where things are going. I'm actually finding it easier to learn programming concepts from using Clojure and involving myself in the community.

acron12:07:54

@grounded_sage I completely agree - getting involved with the community has increased my learning significantly

comma12:07:01

common_creative: i would definitely argue against meteor (if you need somebody to argue against it anyway!)

comma12:07:22

i used it in a medium-sized project at the behest of a client last year and hated every minute of it

grounded_sage12:07:50

@acron: coming from having no programming experience at the start of the year to where I am now I am very impressed with what I have achieved with my spare time. Although I spent a lot of time and some money in the JS and Meteor community. It seems that Clojure will give me a 10x investment from what pure JS could give me. JS community seems like a lot of hackers, whereas Clojure is a lot of thinkers.

acron12:07:57

I wish I'd come to your conclusion 10 years ago...

grounded_sage12:07:48

@comma: I was really invested in Meteor and defending it for some time, but things keep getting messier (more stuff to learn which I have little faith in) which I think is due to the large population of hackers in the JS community in general and the very basis of the language not having been well thought out. The reach is the only benefit I see now.

comma12:07:34

common_creative: i wouldn’t blame meteor’s shortcoming on anybody but the meteorjs team. javascript has its issues yes, but there are many well thought-out projects, look at react!

grounded_sage12:07:04

@comma: True. Perhaps it is because their scope is too large? They are essentially trying to pull in everything JS has to offer and create a glue that makes it easier to choose what [tech / stack?] to use.

meow13:07:07

I just noticed that cljs's implementation of the clojure.string library is less forgiving than the clojure version. For example, in clojure you can do something like:

boot.user=> (string/replace :this-thing "-" "")
":thisthing"

meow13:07:27

In cljs this won't work.

meow13:07:07

Just wondering if that is by design or if cljs should accept keywords as string function args?

meow13:07:57

Just noticed that clojuredocs doesn't have a link to the source code for anything but the core library. Bummer.

meow13:07:23

So clojure does (let [s (.toString s)]

dnolen13:07:55

@meow: I would consider that code to be wrong.

dnolen13:07:19

Note the ^CharSequence type hint, you are just getting lucky.

meow13:07:32

@dnolen: Yes. Funny that clojure does that string conversion.

meow13:07:55

Okay, thanks for the sanity check.

dnolen13:07:48

see the list of known implementing classes

dnolen13:07:26

if you’re passing anything that isn’t one of those, it’s just wrong

dnolen13:07:39

but hey … dynamic typing! 😉

meow13:07:47

@dnolen: It is rather curious that the clojure implementation even points out CharSequence in the docstring:

4. When a function is documented to accept a string argument, it
   will take any implementation of the correct *interface* on the
   host platform. In Java, this is CharSequence, which is more
   general than String. In ordinary usage you will almost always
   pass concrete strings. If you are doing something unusual,
   e.g. passing a mutable implementation of CharSequence, then
   thread-safety is your responsibility."
But then they call .toString on every string argument so I guess .toString is really the interface that they expect.

meow13:07:28

Anyhow, to modify a keyword in cljs I should explicitly call name, modify it, then (keyword result-string) back into a keyword.

kongeor14:07:13

Is calling directly the clj-form instead of using the match macro from core.match a bad idea?

dnolen15:07:39

@kongeor: it’s not a part of the docs or a really a public thing, so use at your own risk.

samueldev15:07:20

In an effort to find a good excuse to learn cljs (since I can't quite learn it through my place of work yet 😠), I'm going to be spending some time over the next couple of months to create a couple of libs that the cljs ecosystem currently lacks

samueldev15:07:36

If anyone would like to help out I'll be looking for contributors simple_smile PM me

triss15:07:08

hey all. how does one approach writing WebWorkers in ClojureScript?

triss15:07:21

I'm looking to port this little bit of code to CLJS: http://webaudio.github.io/web-audio-api/#a-bitcrusher-node

triss15:07:46

but am not sure how to approach the fact that the worker is defined in a separate JS file.

teslanick15:07:59

I would think that you would build a separate target in cljsbuild (assuming cljsbuild) and then load that file from your main JS.

triss15:07:52

ah ok.... not as cozy of a solution as i'd hoped but needs must

triss15:07:26

do you think there no way to make the AudioWorker use functions/code defined in the same file?

triss15:07:55

cheers gtrak. I'l take a look.

kongeor15:07:19

@dnolen: Thanks. If there a clean approach to load the patterns from a config file or a db ?

dnolen15:07:20

@kongeor: there is not, not really a use case that was ever considered

dnolen15:07:05

@kongeor: if it’s the only way to do what you want, then go for it, but note that stuff might change and you may have to change your stuff if you upgrade at some point.

teslanick15:07:04

Note that you can send code to execute to webworkers.

kongeor15:07:09

@dnolen: and I guess creating a macro that will expand the code from the config data so it can use the match macro is not possible either, right ?

sooheon15:07:38

@comma: I’ve got a close friend who I’m learning to code with who is enamoured with meteor. Could I hear some more of your thoughts about what you didn’t (and maybe what you did) like about it?

sooheon15:07:23

Maybe to keep it relevant, in comparison with cljs :)

comma15:07:28

sooheon: my main issue with it was the lack of modules or imports or anything of the like so there’s just a massive reliance on making everything global, your state, your vendor libraries, etc

comma15:07:00

even cljs is getting npm modules working right now but meteorjs won’t let you use them at all

gtrak15:07:27

can't do js without hacks

comma15:07:32

also i couldn’t get over having server and client directives in the same file with a simple if (isServer()) block to tell what worked where

sooheon15:07:57

I see. I guess at the point of us both being beginners with small projects, those issues are harder to see

samueldev15:07:16

@sooheon: for sure, but when those issues do crop up, you will have a big "a-ha" moment

samueldev15:07:00

my advice to beginners is to learn those lessons on your own, then youll understand and appreciate thinks like proper modular composition

sooheon15:07:46

Yeah trying to get there for sure :)

triss15:07:51

can anyone point me at a cljs project that creates and consumes WebWorkers?

triss15:07:40

I'm not sue how to set up m project.clj or how to use cljs namespaces along side them

rauh16:07:26

What is that language "Clo*s*ureScript"? simple_smile

rauh16:07:16

Should this have "cljc" extension included? Currently only "cljs"

dnolen16:07:42

low hanging fruit, somebody should send a pull request to CodeMirror

rauh16:07:01

Yeah somebody just commented on it on the code review page.

dnolen16:07:33

good, still progress!

malabarba17:07:49

Hey everyone. Is there any way I can access stuff that's in the cljs.* namespaces from regular clojure code?

malabarba17:07:59

Forgive me if this is a silly question

malabarba17:07:28

clojure/clojurescript is in the project's dependencies

malabarba17:07:59

But if try to require cljs.reader in a clj file, I get a class not found

roberto17:07:00

not sure you can do that.

roberto17:07:10

yeah, you can’t do that.

roberto17:07:20

cljs => javascript and clj => java

roberto17:07:28

you can write code that is shared between cljs and clj, tho.

roberto17:07:39

if you are in clojure 1.7, have a look at cljc

roberto17:07:47

if you are in an older version, have a look at cljx

malabarba17:07:10

With the new reader conditionals?

roberto17:07:15

you can’t share libraries that depend on the host

malabarba17:07:20

Ok. That might work. Will have to experiment

dnolen17:07:51

@malabarba: Clojure will only load .clj and .cljc, ClojureScript will only load .cljs and .cljc

malabarba18:07:54

And does anyone here know about piggieback

roberto18:07:49

what do you want to do?

malabarba18:07:56

I'm trying to make cider's debugger work with clojurescript,

malabarba18:07:08

But everything in cider are clj files

roberto18:07:35

oh, there is a way to start a cljs repl with cider. I have not been successful with that.

malabarba18:07:48

And it works with clojurescript thanks to piggieback

roberto18:07:01

I use figwheel’s repl to prototype

roberto18:07:15

and if it works, then I write it to a file.

roberto18:07:23

kind of crude, but works for me.

roberto18:07:32

and forces me to keep all my functions small

malabarba18:07:15

It took me a couple of tries, but I've managers to start a repl

malabarba18:07:23

my problem is how to expose clojurescript internals

gtrak18:07:34

@malabarba: take a look at gtrak/cljs-tooling

gtrak18:07:40

that's how cider does it

malabarba18:07:16

@gtrak does it have a way to access vars from cljs namespaces?

gtrak18:07:29

yes, it uses the cljs AST, grabbing it from piggieback

gtrak18:07:38

look at cider-nrepl

gtrak18:07:23

it's just a big data structure, cljs-tooling just uses core functions on it

gtrak18:07:05

how does the clojure debugger work?

malabarba18:07:35

@gtrak I've been looking at that file, but clearly I missed something. ☺️

gtrak18:07:04

i think it's gotten more complicated since the first cut simple_smile

malabarba18:07:19

Cider debug wraps around the nrepl eval op, and it adds a reader macro to the *data-readers* map

gtrak18:07:48

i think piggieback intercepts eval

malabarba18:07:05

IIUC, in order to work with cljs, I need to use the tag-table map instead.

malabarba18:07:28

But that map is in the cljs.reader namespace

gtrak18:07:14

sounds hard simple_smile

malabarba18:07:23

Oh, you think it intercepts eval before anything else can be done on it?

gtrak18:07:10

well, that's what that line i linked is doing

gtrak18:07:49

also, cljs doesn't have threads, so how are you going to pause execution?

malabarba18:07:39

One thing at a time :-)

malabarba18:07:44

So it doesn't have futures either?

malabarba18:07:18

Oh no. I mean promises

gtrak18:07:28

it does have core.async

gtrak18:07:52

but compiling functions into core.async sounds nontrivial

malabarba18:07:20

Well, it has a way of asking for input, right?

gtrak18:07:44

you'll have to be more specific

gtrak18:07:03

it can fire callbacks on events

malabarba18:07:48

I mean like the read function

malabarba18:07:26

Reading from *in*

gtrak18:07:51

if you've ever used any JS apis, they're callback based.

gtrak18:07:54

you don't read from a stream.

malabarba18:07:27

That should be even better

malabarba18:07:03

So you don't have threads but you have async?

malabarba18:07:25

Hey, sounds a lot like emacs

gtrak18:07:54

I'm just confused how you're going to block a function in a single-threaded language simple_smile

gtrak18:07:13

and still be able to respond to input

malabarba18:07:40

No, I can't block, but I think I can rewrite the blocking logic in terms of callbacks.

gtrak18:07:49

yea, that sounds possible

malabarba18:07:56

Will be a ton of work though

malabarba18:07:22

But it won't be the first time I've done this :-P

gtrak18:07:36

it also sounds like it would be highly coupled to piggieback

gtrak18:07:03

but i guess that's the only way to use cider and cljs right now

gtrak18:07:36

I would love to maximize code portability across current and future clj impls, like if clj-in-clj ever happens, and everything shares a tools.analyzer-AST, then I only have to write autocompletion once.

malabarba19:07:51

@gtrak sorry, something pulled me away.

gtrak19:07:21

CLJS tooling is an urgent matter simple_smile

malabarba19:07:34

Yes, it would be very coupled to piggieback, and AFAIK that's the only way to use cider with cljs

malabarba19:07:31

However, we've been meaning to improve the cider cljs experience

malabarba19:07:21

So if you know of a better way to integrate nrepl middleware with cljs, please share :-)

malabarba19:07:07

"We've been meaning" = it's one of the top priorities now.

gtrak19:07:37

nothing specific right now, I haven't hacked on it in a while

gtrak19:07:01

but in general and long-term, I think it'd be awesome to have an nrepl server hosted in cljs.

malabarba19:07:12

Yes. The current setup just feels kinda like a hack

malabarba19:07:40

Not cider, just cljs repls in general

dnolen19:07:22

@malabarba: not sure what you mean, ClojureScript REPLs work more or less like the Clojure REPL

dnolen19:07:54

the state of ClojureScript REPLs outside of the standard ones is something I now refuse to touch

gtrak19:07:31

so is nrepl considered second-class?

dnolen19:07:59

I just use a plain REPL for all my work

dnolen19:07:06

just faster and more predictable

malabarba19:07:10

@dnolen I guess I got that impression from having to start a cljs rhino repl inside a clj repl. But maybe that's not the orthodox way?

dnolen19:07:42

@malabarba: I take it you have not read the Quick Start

malabarba19:07:03

I did actually

dnolen19:07:08

you do need a script to kick off a ClojureScript REPL but that’s because we don’t know what REPL you want to use.

dnolen19:07:17

Node.js, Browser, Rhino, Nashorn

dnolen19:07:31

they cannot be configured in the same way

dnolen19:07:38

no magic pixie dust is going to change this

gtrak19:07:43

i don't care much about the details of the protocol, but nrepl provides valuable hooks for extension, using eval for everything tooling-related is a non-starter.

dnolen19:07:49

but beyond this ClojureScript REPLs specifically mimic Clojure REPL behavior

malabarba19:07:15

It's very well integrated

gtrak19:07:10

so I would be happy with standard repls if we could build on top of them

gtrak19:07:14

in a sane way

malabarba19:07:15

In a lot of ways it's impressive how well it's integrated

gtrak19:07:06

being able to push that code down into server level means editors have less work to do to implement common functionality, vim-fireplace is already a client to cider-nrepl for some things. So even though it's possible to have a workflow without it (I write coffeescript in emacs with no repl), cider is one of the things I really miss about clojure.

dnolen19:07:03

to be honest I’m not a huge fan of nREPL I think it does too much and adds too much indirection. I’m personally excited to see how Socket REPL ends up if it goes anywhere. If it does we’ll replicate that in ClojureScript.

dnolen19:07:22

I think tooling can then decide to support both nREPL & Socket REPL

dnolen19:07:39

I think ClojureScript Cider integration via Socket REPL will be way simpler.

gtrak19:07:42

i'd be happy to target socket repl if it can be used that way

gtrak19:07:52

the middlewares themselves are a small part of cider-nrepl, just being able to pass data around is enough.

malabarba19:07:28

Yes, socket repl has come up repeatedly

malabarba19:07:57

Hope it ends well

gtrak20:07:30

cider can probably support messages with evaling a reader literal or something similar.

gtrak20:07:55

it seems like the socket-repl design will be enough, negotiating multiple connections sounds like the hard part.

wilkerlucio20:07:35

hi, quick question, what's the name of that Clojurescript library that's a very thin layer on React?

gtrak20:07:46

quiescent

wilkerlucio20:07:21

thanks, I was unable to find/spell it's name, hehe

locks22:07:27

(i checked the backlog and didn't find it)

dnolen22:07:18

@locks: I posted it yesterday, but that’s ok simple_smile

mattly23:07:29

it’s a good talk!

bhauman23:07:42

it really is a great talk

leontalbot23:07:12

Om next looks really nice! Love the datomic pull api like queries

nullptr23:07:44

did anybody find the referenced gregor kiczales talk?

dzannotti23:07:25

Has anyone tried fiddling with reagent native demo? I can't seem to get the packager/lein to add more files other than core.cljs