Fork me on GitHub
#beginners
<
2017-10-24
>
rcustodio00:10:22

@noisesmith / @seancorfield, i understand about the AOT and dependencies, snowball effect… now another question, why is aot so bad, this i still dont understand, what it causes, why ppl avoid it

noisesmith00:10:31

well, that snowball effect is mutually exclusive - if two libs try to aot, one wins the other breaks

noisesmith00:10:05

also, there are bugs that can happen in your repl that never happen without aot (things with protocols and gen-class in particular)

rcustodio00:10:09

even if the two libs are completly different?

noisesmith00:10:30

right - because if they use other libs (which most do) only one of them will succeed since the libs are aot compiled

noisesmith00:10:51

and the compiled versions of the same lib are not compatible in most cases - one wins, the other breaks

rcustodio00:10:47

I see, for deploy / production aot is bad because of the libs, and in dev is bad because of repl

noisesmith00:10:27

umm... libs shouldn't aot because that breaks everything if two of your libs use a third lib and also aot compile

noisesmith00:10:31

production or repl

noisesmith00:10:03

as a smaller problem if you aot your app (apps are better to AOT compile than libs), it causes problems when reloading / repl stuff

rcustodio00:10:10

I see, lib 1 and lib 2 use cheshire for example, one of them will break if its aot

noisesmith00:10:01

for your app using aot, the problems are smaller, but can happen even if you dev/repl config doesn't use aot - because if you have aot compiled to deploy your app recently, the repl will want to use that instead of the source code on startup

noisesmith00:10:38

all the app level aot problems can be fixed with workflow discipline and careful program design - but it's a set of problems that go away if you just don't use aot

noisesmith00:10:57

so the general advice is it's easier to just not use aot unless you absolutely need it to run

rcustodio00:10:15

And aot just helps with startup performance

rcustodio00:10:34

A mobile game for example, or a desktop app

noisesmith00:10:48

I often talk to beginners (or even more experienced devs) that waste hours debugging and the problem was a stale aot class file somewhere

noisesmith00:10:10

not run-time performance, just startup time, but I think that's what you mean yeah

rcustodio00:10:46

I understand, server services (apps) startup time doesn’t make that diff

rcustodio00:10:02

it’s a longrun

rcustodio00:10:26

@noisesmith a personal question, do you use boot?

rcustodio00:10:48

I’m testing between boot and lein for that, lein forces a lot the aot

noisesmith00:10:12

umm... aot is a default if you make an app with lein, but it doesn't force you, it's possible to turn it off by editing project.clj

noisesmith00:10:35

I don't use boot, I haven't had to - it seems interesting though

rcustodio00:10:52

I did that, and it keeps showing a warning everytime i use lein uberjar

noisesmith00:10:21

yeah, that warning is annoying - but it is safe to ignore it

rcustodio00:10:32

okey, thanks!!

noisesmith00:10:50

(as long as you know how to start an app that didn't use aot at least 😄 )

leira01:10:35

newbie here. For the "Situated Software" as in Rich's keynote, what is such a typical Clojure software structure look like? Does it use single atom state? What's the difference between such structure and redux? Is there any good open source project I can learn with?

val_waeselynck05:10:26

I think Rich was actually talking about much of the software systems we see out there, e.g any website backed by a database

kevinbheda06:10:50

is there anyting similar to this in clojure ?https://github.com/awaitility/awaitility

val_waeselynck06:10:11

@U3EJ7ND1T (deref fut 5000 :timed-out) maybe?

val_waeselynck06:10:45

Oh no I see it does not work quite the same way. Well I guess it would not be too hard to make an awaitility wrapper in Clojure.

Empperi06:10:30

core.async can provide you with similar functionality taken that you actually build your system on top of it

kevinbheda06:10:06

will look into it. im writing an end to end test for kaka stream , its a bit of java interop involved

val_waeselynck06:10:45

Oh no I see it does not work quite the same way. Well I guess it would not be too hard to make an awaitility wrapper in Clojure.

kevinbheda07:10:40

How do I use both these libraries 1) https://github.com/juhakaremo/clj-containment-matchers

(is (equal? 1 1))
2) https://github.com/mhjort/clj-async-test
(is (eventually (= 1 1)
I want to use both, but the below code throws compile error
(is (evetually (equal? 1 1) 

Arno Rossouw07:10:11

Which web framework is easy to use for a beginner?

val_waeselynck09:10:52

Luminus (http://www.luminusweb.net/) is worth checking out IMHO. I disagree with some of its design choices (such as the use of Mount), but it's definitely well documented and provides a good introduction to the Clojure web ecosystem, especially since it was made by the author of the excellent book Web Development With Clojure https://pragprog.com/book/dswdcloj2/web-development-with-clojure-second-edition

Empperi09:10:18

now that is a question which causes a lot of discussion in Clojure community 🙂

Empperi09:10:51

most think that frameworks are not the way to go, one should compose libraries to do your work. Then again, for beginners that is not exactly the easiest way to approach things

seancorfield17:10:11

I think this is a classic "easy" vs "simple" issue that cuts to the heart of Clojure's philosophy. "Everyone" is used to "easy" web development, which means frameworks that do (nearly) all of the plumbing for you -- but often provide a lot more functionality than you really need as a beginner. And learning a framework means you miss out on learning the basics of what happens under the hood.

Empperi09:10:35

that being said, Clojure has actually very few frameworks, most are just libraries

Empperi09:10:34

Pedestal has both server and client side stuff available in a framework manner https://github.com/pedestal

Empperi09:10:02

I personally haven’t been that interested about that because it is in fact a framework and thus it will ultimately limit my power to do things

Empperi09:10:33

but I’ve heard good things about it

schmee10:10:59

@arno http://www.luminusweb.net/ is a good way to get started

Empperi10:10:02

right, didn’t even remember Luminus

boldaslove15612:10:25

Anybody ever use datascript on the server?

boldaslove15612:10:29

Any good reason for that?

donaldball13:10:20

You may have been thinking of the first alpha version of the pedestal project, which had aspirations of being client-server-framework. The current pedestal service is very comparable to ring, just with a focus on allowing manipulation of the handler stack and enabling async throughout.

seancorfield17:10:11

I think this is a classic "easy" vs "simple" issue that cuts to the heart of Clojure's philosophy. "Everyone" is used to "easy" web development, which means frameworks that do (nearly) all of the plumbing for you -- but often provide a lot more functionality than you really need as a beginner. And learning a framework means you miss out on learning the basics of what happens under the hood.

seancorfield17:10:41

OTOH, Ring is "simple" and learning that first lets you build simple web apps without much pain. Then you can add a routing library (e.g., Compojure, Bidi) which, again, are "simple". So you understand how web apps work at a fundamental level.

seancorfield17:10:46

I think trying to learn a full stack -- ClojureScript on the front end and Clojure on the back end -- all at once is neither "simple" nor "easy" 🙂

Aron20:10:40

i am getting Uncaught Error: Undefined nameToPath for faker also, what's the easiest way to have more debug messages when using cider and figwheel?

Aron21:10:01

stuff is weird, how can i know what is ok to include and what will break?

mseddon21:10:17

how should I document a defrecord, since docstrings don't work?

noisesmith21:10:57

defrecord doesn't create a var, so there's nothing to attach the doc metadata to (I guess clojure could attach it to theconstructor functions it creates, but it doesn't) if nothing else you can make comments - a convention I use is lines starting with ;;; are "documentation comments" for things like that

mseddon21:10:28

Hmm. that's a pity. Oh well, I'll stick to the old emacs ;;; convention for now, thanks!

noisesmith21:10:49

@mseddon another way to do it is to make your own custom constructor (even if it just calls map->Foo inside) and add the documentation to the record there

noisesmith21:10:39

(defrecord Foo [])                                                              
                                                                                
(defn make-foo                                                                  
  "creates a Foo, which is a record that only exists for example purposes;      
   it implements no protocols or interfaces beyond the default, in fact it      
   is only here so we can have a doc string example"                            
  [m]                                                                           
  (map->Foo m)) 

mseddon21:10:42

https://github.com/clojure/clojure/blob/9f277c80258b3d2951128ce26a07c30ad0b47af0/src/clj/clojure/reflect/java.clj#L148 thought I'd look at the source from the docs for those ->'s to see if there was a trick, but it seems that those functions aren't generated from :doc, at least, not as far as I can tell.

mseddon21:10:18

but this is probably getting a little OT.. I can make my way, thank's again 🙂