#clojure logs

2016-03-13

01:43ilevdHi, I can't live without Clojure, what can you recommend me?
01:52burhanloeyOther Lisp?
01:54burhanloeyHylang is a lisp too on top of Python, but I haven't try it yet.
01:55ilevdOther Lisp?
01:56ilevdTry Pixie https://github.com/pixie-lang/pixie
01:56burhanloeyOther lisp = Common Lisp, Scheme, Racket etc
01:57ilevdRacket looks good, but perfomance...
01:57burhanloeyYup, I'm aware of Pixie
03:02ilevdIt's interesting if anybody uses Hylang in production
03:05TEttingerilevd: what are you asking for recommendations on again?
03:05TEttingerlike library choices?
03:05TEttingeror other clojure-like lisp dialects?
03:06ilevdI don't know, I like Clojure but there isn't job on it and I don't know what to programm )
03:17dysfunilevd: quite a few of us here have clojure jobs
03:17dysfunmany of us work for ourselves, of course
03:21ilevdCool!
04:40henkeim currently using this to server index.html (GET "/" {c :context}
04:40henke (redirect (str c "/index.html"))) however this puts /index.html on the
04:40henke path and i want a path that is only / when serving the index page?
05:48Emppericfleming: any way to tell Cursive to recheck dependencies from project.clj when it's been modified outside of cursive?
05:48EmpperiI've been trying out boot as my build tool and have boot auto generate proejct.clj with dependencies for Cursive
05:48Empperithis works fine as long as I've generated the project.clj updates before I launch Idea
05:49Empperiif I do it afterwards I cannot get Cursive to understand the new dependencies
05:49Empperiobviously drives me nuts
05:51Empperiif I quit Idea and reopen it then Cursive understands the new dependencies
05:51TEttingerEmpperi: ooh ooh ooh!
05:52TEttingerI got this fixed yesterday, from cfleming
05:52TEttingerview -> tool windows -> Leiningen, there's a refresh button in a blue arrow circle icon
05:52TEttingerupper left of the tool window
05:53Empperiawesome, thanks!
05:54TEttingersomeone earlier mentioned boot not working as well as could be, but his workaround was the same as what you're doing with the export to lein
05:54TEttingerI think the only problem was .boot files not supported
05:58Empperiyeah nothing is understood in those files
05:58Empperibut I can live with that
05:58Empperias long as my actual code works as expected
05:59Empperisupporting boot as a first class citizen in Cursive is going to be really difficult since the power and flexibility of boot makes it really hard to evaluate for Cursive
06:01dysfunbut what does it really need to integrate?
06:01dysfun'boot repl' is a default, for example
06:02dysfuncider under the hood just changes which command it runs in a subprocess
06:02TEttingercursive uses cider under the hood? isn't cider an emacs thing?
06:03dysfunyes, i'm noting that it was simple for the competition
06:03TEttingerohhhh, I misread
06:03cflemingdysfun: Cursive is more complicated than CIDER in this respect.
06:04cflemingIt needs to know which dependencies to sync, so they can be attached to the project and indexed.
06:04cflemingThat is very difficult in boot.
06:04Empperiyeah
06:04dysfunis it? (get-env :dependencies) doesn't work in nrepl?
06:05EmpperiCursive does not use REPL for code syntax evaluation
06:05Empperiit uses static analysis
06:05cflemingThat only works if a) you execute your build, and who knows what that will do, and b) you're sure you've executed all code paths in your build.
06:05cflemingI have plans for a much better integration, but it will never be perfect.
06:05Empperipart a) is especially true with boot :)
06:06dysfunyes, but i tend to agree that a build is a useful place to write code
06:06cflemingI'm actually becoming a huge Gradle fan.
06:06dysfuni think boot is great for the power it gives you, but i think the api is awful
06:06cflemingYou can write code, but the important bits are still declarative enough that tooling has a chance to work.
06:06Empperigradle has it's own problems too
06:07cflemingSure, it's a build tool - it's a matter of choosing the one you hate the least
06:07dysfuni would expect that it's going to work fine 90% of the time+
06:07dysfunall of my build.boot start off with (set-env! :dependencies ...)
06:07dysfunand i think most other people are the same
06:07dysfunno reason static analysis can't pick that sort of thing up
06:07Empperiyeah but nothing forces you to do it like that
06:07cflemingdysfun: Sure, and that case is relatively easy to solve statically.
06:07Empperithose scenarios are easy to support
06:08cflemingBut I've heard of people keeping their deps in maps and dynamically loading those maps etc
06:08cflemingBut I'm ok with telling those people that they're off the Cursive beaten path and that bets are off.
06:08dysfunyeah, i'd do exactly that in your position :)
06:09EmpperiI'd be happy if Cursive would support a) set-env! based dependencies b) would recognize defined tasks
06:09Empperiplus would understand the code itself meaning it wouldn't try to tell me there is no such thing as set-env! or deftask and so forth
06:09cflemingEmpperi: Yes, all that is possible and planned.
06:09Empperidon't need REPL integration or anything it doesn't already have
06:10Empperisince with boot you pretty much want to start nrepl and connect to that
06:10Empperiyou'll lose debugging which sucks but so does life sometimes
06:10cflemingYeah, debugging might be tricky but remote debugging is always an option.
06:10Empperiyeah
06:11dysfuni'm facing this dilemma at the minute actually for a documentation tool
06:11dysfuna certain amount of static analysis topped up with a certain amount of executing code i think
06:11dysfun(i want to produce clojure and clojurescript docs in one document)
06:11Empperibut if I need to make a choice between boot support and macro improvements I'll choose the latter :)
06:11cflemingEmpperi: BTW better macro solutions are coming down the pipe soon too, I know that's been hurting you.
06:12cflemingHaha snap
06:12Empperiyou read my mind lol
06:12Empperiikitommi_ will be happy to hear that too
06:14cflemingYes, no doubt
06:24dysfunhow have you found building on top of eclipse in practice, then?
06:24cflemingdysfun: Me? Cursive is built on top of IntelliJ
06:24dysfunoh
06:25cflemingCounterClockwise is the Eclipse one.
06:25dysfunah that's right
06:27cflemingIntelliJ is actually really nice to build on, but it's enormous and almost totally undocumented.
06:28cflemingI ran cloc over it the other day actually, the community edition is 3.9 million LoC
06:28dysfunwow
06:28cflemingIt takes a while to check out.
06:29dysfunhaha, longer than webkit?
06:29cflemingI've never tried, but I'd bet a beer that it does.
06:29dysfunwebkit is 5gb
06:29dysfun(the git repo)
06:29cflemingThat's quite a lot.
06:30dysfunyeah. it's the sort of thing where you start to notice git doesn't tell you how much it intends to download
06:30cflemingNot sure how to check that size on the community edition, I can't find a simple way to clean the build artifacts.
06:31dysfunhah
06:32cfleming(there probably is one, but I only have the code for reference, I don't actually build + run it)
06:32dysfunoh, git clean -df then
06:32cflemingOf course
06:33cflemingdu -sh show 4.9 GB
06:33dysfunwow, so totally comparable to webkit
06:33cflemingLooks like it, yeah.
06:35cfleminghttps://github.com/JetBrains/intellij-community/graphs/contributors
06:37Empperi168 678 commits :)
06:37Empperiand 32 925 releases
06:37Empperilol
06:38cflemingyole tops out at like 100 commits/week
06:38EmpperiJetbrains employee?
06:41cflemingYeah, he was their senior engineer and CTO for a while.
06:41cflemingAll those people are JetBrains employees I think.
06:42cflemingOk, bedtime for me
06:43Empperinight
09:50kwladykajustin_smith is it possible to use Clojure libraries in Clojure .NET? I guess not. Clojure .NET has additional modules?
09:54dysfunkwladyka: anything that taps into underlying java will not be usable on .NET. you will need to find clj/clr code or write your own (or just use the .net objects directly)
09:55dysfunclj/clr is not commonly enough used that people really bother testing against it
09:55kwladykadysfun do you have some experience with Clojure .NET?
09:55dysfunabout five minutes before it made me want to throw my keyboard at the wall
09:55dysfunbut that was some while ago and it may be better now
09:56kwladykawhat was the problem?
09:56dysfuni may have been jesting slightly. i spent a few hours trying to get a game going on it. first with arcadia and then with unity
09:57dysfuni found it all a bit frustrating. the tools just aren't there yet
09:57dysfunclojure + emacs is an extraordinarily rich and powerful tool when configured correctly. clj/clr i don't know if cider even handles it
09:58dysfunand the less said about trying to hack clojure in monodevelop, the better
10:00dysfunthe truth is that a heck of a lot of what i love about clojure comes from binding to libraries written in java
10:00dysfune.g. i use aleph for a webserver. under the hood that's netty. i don't know if there even is an already wrapped webserver in clj/clr
10:03justin_smithdysfun: hell, I don't even know if ring works on clj/clr
10:03dysfunright, because nobody bothers testing it
10:04justin_smithdysfun: and more importantly, it uses java classes
10:04dysfunoh, i didn't know that
10:04dysfuni suppose it makes sense
10:04justin_smithit implements protocols over OutputStream etc.
10:05justin_smithI mean I bet it would be easy to port, but it hasn't been done that I know of
10:05dysfun"Updated on 24 Jan"
10:06dysfun(clojure-clr)
10:07dysfunhttps://github.com/clojure/clojure-clr/pull/8
10:07dysfunif it doesn't even build except on windows, it's not fit for deploying to production
10:08dysfuni can't help but think if that effort had gone into an llvm backend, it might have been worth it
10:10xnapeakHi - I'm calling a constructor inside a Java lib, and the constructor requires casting the value nil to java.util.List<String>. Is there a way to call cast or do type-hinting with generics?
10:10justin_smithxnapeak: generics are fictional, but you can definitely pass a java.util.List that is empty
10:10dysfunthere's no such thing as a generic at runtime. that is java.util.List, not java.util.List<String>
10:11dysfunof course if you put things other than strings in there, you get to keep the pieces
10:12xnapeakjustin_smith It has to be nil, not empty
10:12xnapeakEg. (nil? (java.util.Vector. [])) returns false
10:12xnapeakand just putting in nil without casting returns an IllegalArgumentException
10:12dysfunplease show a correct java incantation for it
10:14xnapeakdysfun I can't find one, but here's the original source code: http://pastebin.com/FY8gYBKt
10:14xnapeakI'm trying to set m_Type to STRING
10:14justin_smithxnapeak: for that matter, clojure vectors and lists are instances of java.util.List
10:14xnapeakdysfun Here's an incantation in Scala: val att3 = new Attribute("att3", null.asInstanceOf[util.ArrayList[String]])
10:14justin_smith,(instance? java.util.List [])
10:14clojurebottrue
10:16dysfunright, i see, you want null
10:16justin_smithnil is null though... the trick is the asInstanceOf
10:16dysfunyes, i see the problem
10:17dysfuni don't have a good answer though
10:17justin_smithxnapeak: scala is weird and you can't even use it from java, do you have working java?
10:17dysfunjustin_smith: sure you can. some of it.
10:17justin_smithxnapeak: if you are trying to call scala from clojure, give up now, not even worth trying
10:18dysfuncan you imagine if people started using clojure on top of the typesafe platform? hahaha
10:19xnapeakjustin_smith Oh, I'm not using Scala at all, that was just an example of a call to that constructor I found on GitHub
10:19dysfunsorry, i mean "lightbend reactive platform"
10:19xnapeakjustin_smith I don't have a Java environment set up, I could but that might take a while
10:19justin_smithOK - a java example would be much better
10:19dysfunxnapeak: lein can compile java
10:19justin_smithxnapeak: clojure is a great platform for using java :)
10:19xnapeakOK, will try to find one
10:20dysfunin fact lein and boot make it super easy to switch your slowest/most hit code to java
10:21dysfun(jmonkeyengine requires you to subclass an abstract class, for example, so you have to write a tiny bit of java if you want to use it)
10:21xnapeakjustin_smith Okay, here's a Java call: new Attribute("content",(ArrayList<String>)null)
10:22xnapeak(That's is not my code, just another example I found on GitHub)
10:25dysfununless justin_smith has an idea, i'm going to suggest you write that bit in java
10:25dysfun(using your clojure build tool to build it for you)
10:27amalloy(let [^List foo nil] (Whatever. foo))
10:28xnapeakamalloy That works. Thanks!
10:29xnapeak(Well, (let [^java.util.ArrayList foo nil] works, but close enough)
10:29dysfunamalloy: hrm, i didn't realise type hints could be used to guide method selection
10:29dysfunhow does that work?
10:29amalloythat is kinda the only thing you can use them for
10:30amalloyselect a method at compile time instead of at runtime with reflection
10:30dysfunoh yes, of course
10:30dysfunsuddenly that makes sense now
10:34MalnormaluloDoes anyone know of any good implementations of a data structure which is unordered under equality-checks (like a set), but allows duplicate members (like a list)?
10:35Malnormalulo(Also, does anyone know if a structure like that has a common name?)
10:35dysfunis it safe to assume that the namespace declaration is the first form in a clojure file if it is not missing?
10:35dysfunMalnormalulo: a 'bag' fits that bill
10:36MalnormaluloAha, bag. Thanks, I'll look for one of those
10:36dysfunalso known as a multiset
10:36dysfunessentially you can think of it as a map where the key is the item an the value is how many times it occurred
10:36dysfun(and that's not an unreasonable representation)
10:36MalnormaluloYeah and I was thinking of just using a structure like that, but a more direct representation would be convenient
10:37dysfunbut then you'd want a persistent one and that might take finding
10:37dysfunand also it wouldn't interop nicely with clojure code
10:37amalloydysfun: ns should be first in a well-written program, but i don't think you should assume it actually is
10:38Malnormaluloalso, I agree with amalloy
10:38dysfunthe plan was to check the first sexp in the file with tools.namespace
10:39dysfunwhat would you recommend i do instead?
10:40amalloywhy?
10:40clojurebotwhy is the ram gone
10:40dysfunclojurebot++
10:41dysfunbecause i'm writing a compiler that uses tools.reader to get clojure syntax for free and i need to know what namespace to read it in so syntax quote works
10:42amalloyso what you're reading isn't clojure source files at all, but source files for some other language that happens to use clojure lists/symbols/etc?
10:42dysfunyes for this one, no for my back burner clojure-to-machine-code project
10:44dysfunthe ideal for that one is to be able to share with clojure and clojurescript in cljc files
10:46dysfunwell formedness would be a requirement on that though, so i'm okay with bailing out if the first expression isn't an ns decl
10:55dysfunit also occurs to me that build.boot is not well formed by that rule
11:04csd_any suggestions for managing environment vars on heroku? i want to set a secret key but my .lein file doesn't get uploaded when i push to heroku as that would require putting it in my git repo
11:05csd_i know i can do it using the CLI tool but i'm wondering whether a better solution exists
11:05justin_smithcsd_: I thought heroku had a command for setting environment vars directly
11:05csd_yeah it does through the CLI
11:05justin_smithcsd_: ideally you would do that, then pick the value up using environ
11:06csd_i dont love that because i feel like it hides the var from you
11:06justin_smithcsd_: it's hiding the var from more than just you, and that's the point
11:06csd_fair point
11:16Empperihmm, can't get boot to read project boot.properties
11:16Empperiany hints?
11:16Empperigot the boot.properties in the same directory as my build.boot
11:16Emppericreated the base with boot -V > boot.properties
11:16Empperithen edited Clojure 1.8.0 in
11:17Empperibut boot isn't using it
11:19dysfunspecifically, what line did you change?
11:19EmpperiBOOT_CLOJURE_VERSION=1.8.0
11:19Empperiand yes, I do know one has to define Clojure dependency to build.boot too
11:20dysfunhrm, what's your BOOT_VERSION ?
11:20EmpperiBOOT_VERSION=2.5.5
11:20dysfuncan you pastebin the output of boot -V with that properties file in place?
11:21Empperino prob, altough there's nothing special except it says 1.7.0
11:21Empperihttps://www.refheap.com/115902
11:22Empperiso it doesn't read the properties file
11:22dysfunhrm, are the permissions funny or anything?
11:22Empperinope
11:22Empperiwindows however
11:22dysfunohhh
11:23dysfunno clue about boot on windows
11:23Empperithere shouldn't be anthing special
11:24Empperifucking up as simple thing as reading a file from working directory cannot be something they'd do
11:24dysfunthat's true
11:24dysfunand you're definitely sat in the right directory? :)
11:24Empperiyes
11:24Empperivery much so
11:25dysfuni'm out of ideas then. You can try #hoplon, that's where the boot guys hang out
11:25Empperihmph
11:25Empperiyeah, guessed so
11:25Empperi:/
11:52Empperidysfun: found out why it happened
11:52Empperihttps://github.com/boot-clj/boot/blob/master/boot/base/src/main/java/boot/App.java#L153
11:53Empperiboot prefers boot.properties first from bootdir() then from projectDir() and then from workdir
11:53Empperiwhich is imho totally wierd, it should be the other way around
11:53Empperiweird even
11:53Empperiif I went to ~/.boot/ I found boot.properties from there and I modified it and now boot runs with Clojure 1.8.0
11:55Empperioh right, forget about the prefer part from that. It uses HashMap... *blush*
11:58dysfunEmpperi: hrm, i agree it seems like the wrong logic
11:58Empperiit isn't like that
11:58Emppericheck mergeProperties at line 159
11:59Empperithere it iterates the properties files in order boot dir -> project dir -> cwd
11:59Empperiand merges the values together so that last directory should override earlier
11:59dysfunohh
11:59Empperibut it also swallows FileNotFoundExceptions
11:59dysfuni see
12:00Empperithey should add those exceptions into debug logging or something
12:00Empperinow it's super hard to know wtf is going on
12:00dysfuner, no, because typically cwd isn't going to return one
12:00dysfunbut it's lazy coding
12:00Empperiyeah
12:01EmpperiI agree
12:01Empperiand to me that Java looks horrid :)
12:01Empperithe style it is written
12:01Empperinot necessarily the quality
12:01Empperibut that's just me
12:03Empperioh well, I can go forward now since I got it running with Clojure 1.8.0
12:03dysfunyes, it's particularly offensive on the eyes
12:03EmpperiI was considering to clone boot and try to find out what is happening and make a pull request but I really don't want to edit Java code which looks like that
12:03Empperi:)
12:03dysfunbut i think the boot source code is a good example of why you should use clojure - to not have code that looks like that
12:04Empperiwell, truth to be told, that is just ugly java
12:04Empperigood thing is that those methods are relatively small and they do only one thing
12:04Empperibut one could do those things much more elegantly
12:04Empperiin java
12:04dysfunyes, but one has deadlines :)
12:04Empperi:)
12:06Empperioh well, Now I got cljs-repl to run
12:06Emppericouldn't get it to run with clojure 1.7.0
12:08Empperiany ideas on compound nrepl instances?
12:08EmpperiI mean, now I got two nrepls running, one for clojure and one for clojurescript
12:08Empperiboth write .nrepl-port which will cause the latter to be there only
12:09Empperiand besides, I don't want to connect to that repl twice unless I really want to do so
12:09Empperiso, it would be great if I could connect to nrepl, it would greet me with prompt like "To access clojure REPL type (clj-repl), to access ClojureScript REPL type (cljs-repl)"
12:09Empperiand I could jump between those two repls as I see fit
12:10justin_smithEmpperi: you can always ignore the .nrepl-port file and just supply the port explicitly when connecting
12:10Empperijustin_smith: yeah, but .nrepl-port is very convenient
12:10Empperione doesn't have to know what port it is running
12:11justin_smithI've found having two repls in emacs nothing but inconvenient
12:11justin_smithmaybe it's improved since I gave up on repls inside emacs though
12:11Empperiwell, one needs two with clj+cljs
12:11Empperione for both
12:11Empperiand I use Cursive
12:11justin_smithoh, OK
12:12Empperior well, one doesn't HAVE TO use REPL for either one but... :)
12:13Empperihmm, it makes me feel like I might have a good candidate for custom boot task with that compound repl thingy
12:16kwladykadysfun from what you saying i can get a conclusion maybe Clojure .NET it is bad idea and should exist?
12:24kwladyka*shouldnt
12:24kwladykafrom other hand maybe it is not ready or .NET has bad community or i don't know :)
12:29TEttingerthe CoreCLR community has been hyper-responsive in my limited bug reporting
12:29TEttingerreally good show on some stuff that they fixed (took a while because apparently they don't use windows 7 much)
12:31TEttingerI do think that F# being MS-backed and IDE-supported (rather well, too) takes the motivation for using any other multicore/immutable/functional language down
12:31TEttingeron the CLR I mean
12:46kwladykaTEttinger Did you do something for production in Clojure .NET?
12:48TEttingerno, I did look at it enough to see it didn't have a reasonable way to work with multi-dimensional arrays though, which my existing code in C# used heavily
12:48TEttingeryou can use jagged ones fine, but not rectangular it seems
13:00hyPiRiondysfun: https://en.wikipedia.org/wiki/Jagged_array
13:00hyPiRionIn short, arrays of arrays, where the inner arrays may be of different lengths
13:00dysfunthen how on earth if it can handle those can it not handle rectangular ones?
13:03dysfunhyPiRion: damnit i've fallen down a wikipedia hole because of you
13:09hyPiRionI guess it depends on how the rectangular arrays are implemented.
13:10hyPiRionUsually they are just a single block of memory for performance reasons, whereas a jagged one is an array of array pointers
13:14csd_any suggestions how you would remove the conditional nesting in this snippet http://pastebin.com/546s0ZQt ? i'm interested in checking out the cats category theory library and using `maybe`. not sure how well that would work because of the db calls though
13:25TEttingerhyPiRion: dysfun: they're different types on the CLR.
13:26TEttinger.NET and Mono allow you to do "new int[40,20,10];", which helps since they don't have the all-at-once jagged array initializer in Java like "new int[40][20][10];"
13:27TEttingeryou can still do "new int[40][][];"
13:27TEttingerand then assign different or the same lengths to members
13:34gilchdysfun: I've been using jMonkey Engine without writing Java so far. What would you need it for?
13:35dysfuni don't remember any more. i think it was to do with certain features only being available if you used this abstract class interface
13:38gilchclojure can use proxy to make an anonymous subclass of a java class
13:39gilchIt can't access protected members, but you can use reflection for that, or even gen-class if you compile ahead of time
13:39dysfunah yes
13:42gilchI think most protected fields in jME that you would care about have public accessor methods anyway.
13:43dysfuni didn't play with it much, it was just something i remembered about it from a while ago
14:18WickedShellThis has to be a stupid question but whats the standard protocol that I need to implement on my records to get meaningful results for when toString or (str ) is called on a record?
14:19justin_smithWickedShell: toString method on Object, but really records usually print nicely, deftype on the other hand will need help
14:20WickedShellthey just keep printing their name and a pointer IE "swiftgcs.utilities.Waypoint@c050c63c"
14:20justin_smiththen toString is not what is being called, or it isn't created with defrecord
14:21WickedShellit's being created with a (str "desc " record-here)
14:22justin_smithhmm - maybe I'm wrong about toString - try implementing it eg. (defrecord Foo [] Object (toString [this] ...))
14:22WickedShelland its a defrecord, with the actual instance made with (new RecordName field1 field2 etc)
14:22justin_smith(defrecord Foo [] Object (toString [this] "this is a foo"))
14:22justin_smith,(defrecord Foo [] Object (toString [this] "this is a foo"))
14:23clojurebotsandbox.Foo
14:23justin_smith,(str (new Foo))
14:23clojurebot"this is a foo"
14:23justin_smith,(defrecord Foo [] Object (toString [this] (pr-str this)))
14:23clojurebotsandbox.Foo
14:23justin_smith,(str (new Foo))
14:23clojurebot"#sandbox.Foo{}"
14:24irctchi guys. anybody here?
14:24justin_smithalways
14:24irctccool
14:25WickedShelljustin_smith, thanks that looks like exactly the behavior I'm looking for
14:26justin_smithawesome
14:26irctcI've been looking at clojure on and off over the last couple of months but I've not clue what this does: (def ^:dynamic *re-password* #"^(?=.*\d).{4,8}$")
14:26irctcactually it's just the ^:dynamic bit that's not clear to me
14:26justin_smithit defines a thread-bound var, and the root binding is a regex
14:27justin_smithirctc: dynamic vars can carry a different value in each thread
14:27justin_smithuse them with binding
14:27justin_smith,(doc binding)
14:27clojurebot"([bindings & body]); binding => var-symbol init-expr Creates new bindings for the (already-existing) vars, with the supplied initial values, executes the exprs in an implicit do, then re-establishes the bindings that existed before. The new bindings are made in parallel (unlike let); all init-exprs are evaluated before the vars are bound to their new values."
14:28justin_smithalso, futures inherit dynamic vars from their calling thread
14:28irctc@justin_smith. thanks. I think I get it. Not sure why it would be needed in this specific case...
16:24CaptainLexSo, if I have a function foo
16:24CaptainLexand a function bar that calls foo
16:24CaptainLexand I re defn foo in a repl session
16:25CaptainLexDoes bar call the old or the new version of foo?
16:25justin_smithCaptainLex: depends how bar was defined - if bar was a defn yes, if defined using eg. comp, perhaps not
16:27CaptainLexjustin_smith: Yes, I see. I wonder what else is going on here...
16:27justin_smiththe difference is whether a first class function was used.
16:27justin_smiththe most common cause of this is that someone runs something like (start-server foo) - where foo is a first class function argument
16:28justin_smiththat won't see any change in the var #'foo
16:29CaptainLexInteresting. That's because when it gets passed, it doesn't care about the identifier anymore? And is there any alternative way to cause this kind of behavior?
16:30CaptainLexI suppose it would to only /pass/ thin wrapper functions that call the functions you want re-eval?
16:30justin_smithCaptainLex: simpler is to pass the var
16:30justin_smithif you run (start-server #'foo) it will deref the var each time it uses it, instead of caching the value
16:31justin_smiththis is because when you call a var, the var looks up its own contents and calls that with the same args
16:31justin_smith,(#'+ 1 2 3)
16:31clojurebot6
16:31CaptainLexjustin_smith: Whoa, yeah
16:31CaptainLexThat's awesome
16:31CaptainLexThanks!
16:32CaptainLexAlso that explains things I've seen in other projects I've worked on
16:32justin_smithdefinitely a cantidate for a faq entry
17:34duck1123Does anyone know why I would be getting a Invalid :refer error when compiling cljs in a docker container, but not outside?
18:39rhg135I tried to write a blog post about it, justin_smith, but it might not help
18:40rhg135http://www.rhg135.com/posts/2015-08-23-var-or-fn.html
18:44rhg135It seems a very frequent question
18:49rhg135Compiler version perhaps, duck1123
18:50justin_smithalso I'd compare dependency versions in general, and also make sure build targets have been cleaned since the last change - cljs has bad caching logic sometimes when it tries to incrementally build
19:47michaelroseok dumb question I thought you needed to install templates somehow so figured you had to clone the repo for the template in question and do lein install in that dir which appears to have been utterly uneccesary
19:48michaelroseif I understand properly all the lein install actually did was download the proper files to ~/.m2/dir
19:49justin_smithmichaelrose: right, and it would do that anyway if you just used lein new with the template
19:49justin_smithmichaelrose: but! that does avoid the problem I have with templates, which is that they are unversioned (and this tends to break internet tutorials, which is a problem)
19:49michaelroseso I didn't mess up anything which is good
19:50justin_smithheh, sure
19:50michaelroseoh so basically manually installing it would ensure I could grab it at a known point
19:50justin_smithnow that I say that, I wonder if lein wouldn't look for the latest anyway regardless...
19:50michaelrosewhereas if I had just done lein new name it would grab the latest available
19:51michaelrosethat should be easy to test
19:55michaelrosejustin_smith, it does not
19:58rhg135that is awesome-ish