other-languages

here be heresies and things we have to use for work
seancorfield 2016-06-03T00:03:38.001220Z

The irony here is that clojure.string/lower-case (and others) call .toString on their argument already so if they just called str instead, we’d get nil-safe behavior!

cfleming 2016-06-03T00:06:26.001221Z

I think my problem is that I no longer think of Clojure’s nil-permissive behaviour as nil-safe.

cfleming 2016-06-03T00:07:03.001223Z

I’d rather know about the problem than have it be masked.

cfleming 2016-06-03T00:07:32.001224Z

And if I’m really just doing something tricky, I’d rather have it explicit in the code so I (and everyone else) knows what’s going on.

arrdem 2016-06-03T03:22:01.001225Z

Yeah definitely gonna jump in here on the side of nil punning breaking down badly with interop.

arrdem 2016-06-03T03:22:26.001226Z

seancorfield's examples of clojure.string behaving really badly with nil arguments has bitten me in the past.

arrdem 2016-06-03T03:23:12.001227Z

Likewise Compiler.java likes to use nil punning in places to implicitly mean the Object type, and in others expects a concrete non-null java.lang.Class and so on and soforth...

arrdem 2016-06-03T03:23:52.001228Z

I think I had an earlier rant in here about how nil doesn't even always make sense as a pun for anything because it's type indeterminate and you may not have a base element anyway...

arrdem 2016-06-03T03:30:55.001229Z

Honestly for me the big win of core.typed the times I used it in anger was that after extended dinking with the type annotations it found a crapload of real programmer failures to deal with nil values correctly.

arrdem 2016-06-03T03:31:32.001230Z

At this point I'm getting by with pre/postconditions that essentially assert either a hand-rolled structure type, a schema type or a spec where I have to explicitly state that nility is OK.

cfleming 2016-06-03T05:29:17.001231Z

Meanwhile… https://twitter.com/cmeik/status/738576083671355393

sveri 2016-06-03T05:39:57.001233Z

HM, i cannot remember my last NPE either in clojure. But also, i don't see them so often in Java anymore. I would guess it is because after doing 5 years of Java almost daily i recognize the spots where they occurre most often and handle then accordingly. Or maybe I was just lucky 😄

borkdude 2016-06-03T06:31:13.001234Z

what would be the alternative to nil punning in a dyn.typed lang?

tjg 2016-06-03T07:39:18.001235Z

@borkdude: Here's a ballad about lack of nil punning in Scheme dialects: https://ashwinram.org/1986/01/28/a-short-ballad-dedicated-to-the-growth-of-programs/

tjg 2016-06-03T07:40:25.001237Z

I don't offhand know about other alternatives, like abolishing nil.

tjg 2016-06-03T07:44:19.001239Z

Also, @ericnormand had a good article on this topic http://www.lispcast.com/nil-punning

borkdude 2016-06-03T07:45:20.001242Z

If you want to gain a re-appreciation of Lisp, dynamic typing and Clojure, try working with Scala in a team for a couple of months. It helps. 🙂

sveri 2016-06-03T07:47:54.001243Z

Or Java

cfleming 2016-06-03T07:58:17.001244Z

I feel like I’m a broken record here, but the more Kotlin I write, the less Clojure I feel like writing.

cfleming 2016-06-03T07:58:51.001245Z

I’m sure the same would be true of other languages, but Kotlin’s just what I’m working with when I’m not using Clojure

sveri 2016-06-03T07:59:47.001246Z

I wonder if some confirmation / group bias is going on here and if I fall myself into it

sveri 2016-06-03T08:02:13.001247Z

I mean, I am sure I would prefer clojure over Java, without hesitation, but then, Kotlin, makes me wonder. I saw one of the developers give a talk about it on a java conference two years ago and was fascinated back then, but, as it was not nearly 1.0 I only took a short look.

borkdude 2016-06-03T08:02:30.001248Z

@cfleming: I would try Kotlin too, won't be looking at Scala anymore. Too slow and complex.

sveri 2016-06-03T08:03:05.001249Z

Also he said that a lot of teams working for jetbrains are already switching to kotlin (most of them are free to choose the language they code in)

cfleming 2016-06-03T08:03:39.001250Z

Yeah, they’re starting to use it heavily in IntelliJ itself

borkdude 2016-06-03T08:03:54.001251Z

Scala breaks concentration flow. Clojure has a REPL. Kotlin is fast. Maybe both good remedies.

cfleming 2016-06-03T08:04:04.001252Z

I read somewhere that they already have 500k LOC Kotlin across their various projects.

cfleming 2016-06-03T08:04:23.001254Z

I do still end up waiting for Kotlin to compile - a REPL would be nice.

borkdude 2016-06-03T08:04:45.001255Z

@cfleming: That's what I miss so much in Scala, a REPL that gives me some verification if things work the way they should.

borkdude 2016-06-03T08:04:56.001256Z

without having to recompile all the time

sveri 2016-06-03T08:05:00.001257Z

Haha, thats what I just wanted to add, but then I look at kotlin and think where is my REPL? Möp, have to wait for compile / run tests..

cfleming 2016-06-03T08:05:12.001258Z

Right, I end up using tests instead, which is not the same.

borkdude 2016-06-03T08:05:45.001259Z

@cfleming: They are more reproducible though. You start with a clean state. No "REPL REPL, your state is a mess"

cfleming 2016-06-03T08:06:21.001260Z

Yes. And what I tend to find is that when I test things in the REPL, I often don’t write unit tests afterwards, and then I break the code later.

cfleming 2016-06-03T08:06:38.001261Z

That’s my fault, clearly, but the REPL encourages that.

borkdude 2016-06-03T08:06:58.001262Z

@cfleming: also my experience

sveri 2016-06-03T08:07:03.001263Z

In clojure I adapted my workflow to this (after learning making heavily use of the REPL). I write tests for most of the stuff, but, if things dont work as expected I fire up the repl and figure out the right approach, and then put that into my tests. So still the REPL is a big part of my workflow, even using many more tests now

cfleming 2016-06-03T08:07:30.001264Z

I really want to implement a wallaby.js type thing for Clojure.

sveri 2016-06-03T08:08:27.001265Z

hm, what is the advantage over test-refresh? @cfleming

cfleming 2016-06-03T08:08:53.001266Z

It’s more immediate, and only runs the actual tests (not the test namespace) which have changed.

cfleming 2016-06-03T08:09:01.001267Z

And you see the results right alongside the code.

cfleming 2016-06-03T08:09:44.001269Z

Plus you get code coverage for free.

cfleming 2016-06-03T08:09:51.001270Z

Again, in your editor.

sveri 2016-06-03T08:10:08.001271Z

Ok, i just saw the preview, agreed, that is nice feedback

sveri 2016-06-03T08:10:22.001272Z

Something like this should be possible with Lighttable for instance?

sveri 2016-06-03T08:10:32.001273Z

It reminds me of their inline evaluation

cfleming 2016-06-03T08:10:45.001274Z

Not really, it needs to instrument the code that it executes in some way.

borkdude 2016-06-03T08:11:02.001275Z

(s/instrument ...) 😉

cfleming 2016-06-03T08:11:12.001276Z

It will run the tests corresponding to the code you have changed, since it has the coverage info.

cfleming 2016-06-03T08:11:19.001277Z

Not that one 🙂

sveri 2016-06-03T08:42:08.001278Z

And again, looking at web stuff, the current state is this: http://karaframework.com/docs/overview.html, which does not even have a deployment story yet or this: http://www.yested.net/ which does not even have a kind of generator or description how to add the dependency to maven / gradle. Which is a sign of lack of experience in my case. Not to question the authors intent, I may be wrong here, but I wont touch them if I have much better alternatives

cfleming 2016-06-03T08:42:51.001280Z

No, the tooling is bound to be immature compared to Clojure, especially for web work since it’s not JetBrains' main focus.

cfleming 2016-06-03T08:43:13.001282Z

I don’t do web dev myself so have no idea what the tooling is like there.

sveri 2016-06-03T08:43:50.001283Z

Yea, on the other hand, if I wanted to do some android stuff I would definitly look for kotlin instead java.

sveri 2016-06-03T08:44:12.001284Z

or clojure

sveri 2016-06-03T08:46:49.001285Z

In clojure it is relatively easy to setup a backend and talk via websockets to the frontend and have it all conform to a spec now (for which I used schema before), sharing logic is easy, thanks to cljc and it all because of all the work that was done by a lot ofopen source contributors