Live data from Hacker News

Clojure 1.9 is now available

blog.cognitect.com

111–120 of 121 posts

Re: Clojure 1.9 is now available

#111
post #100

I'm disappointed that spec didn't get beyond alpha for this release. This worries me a little just because in the past a lot of stuff in Clojure releases has felt abandoned after a while - transducers were new in 1.8, but couldn't use the parallelism of 1.7's reducers (do we use them still?!) because of the way stateful transducers worked. I don't see this having been worked upon for this release. As it is, spec is p…

There have been things that were alpha parts of Clojure for years in the past. They were eventually finalized or in a few cases deprecated. Given that few people try alpha software, it's better to release and let people use it while the work is finished. I have no doubts that spec will finish and leave alpha.

spec is one of the fastest libraries available for validation (http://muhuk.github.io/validation-benchmark/). spec is not designed for extension by making new kinds of spec. It's designed to utilize any predicate function on the bottom and by combination from the pieces available. By analogy, is LEGO bad because it's hard to make your own bricks? That's just not how you use it.

There are some known problems that make generation slow (mostly having things that grow too quickly in combination). One known problem was fixed in the late stages before release and we will continue to work on the sizing issues.

There is more to the generative testing story that has not yet surfaced. We've got another whole project related to this that is still a work in progress. Even without that, I think there is a lot of value to be had in spec right now.

Re: Clojure 1.9 is now available

#112
post #31

Earlier quoted context omitted.

I agree, but it does take a while to figure out that leiningen exist And then you learn that not everyone use leiningen ... and things become a bit more confusing than necessary for some people, especially beginners

``brew search clojure`` used to find leiningen; not sure why not now. In fact it used to find leiningen instead of clojure; possibly clojure didn't exist as a brew tap before.

Previously, there was no brew formula for clojure and there was a hardcoded pointer to leiningen. When the clojure formula was added, that was removed.

Re: Clojure 1.9 is now available

#114
post #43
post #42

Is clojure.spec a replacement for static typing? I ask because I've taken a look at clojure in the past and generally like what I see, but after moving from JavaScript to TypeScript at work I don't think I can ever return to a dynamically typed language again. Types are just priceless when refactoring, integrating someone else's code with your own or just exploring new libraries or APIs.

It addresses similar problems as static typing, yes, but it's not a compile time check. Instead, it's an optional runtime check. The idea is to use it during testing and development, and have it be disabled during production.

Macros are checked at compile time. So it is a static check to some extent.

Re: Clojure 1.9 is now available

#115
post #92

Earlier quoted context omitted.

A small detail - Clojure has 20,000 libraries of its own. See http://clojars.org .

Npm (javascript's NPM) has over 500,000 libraries right now. Do this makes JS a better language than Clojure, or a better choice? No way. And everytime some javascript fan would go against Clj/ClojureScript use citing "Clojure has 25x less libraries", i will defend Clojure. How many libs do we really need? So far i have found all libs I needed for Common Lisp. Many of them have high quality, at least in the sense tha…

I was actually praising Clojure, ie. doesn't necessarily depend on Java libraries.

Re: Clojure 1.9 is now available

#116

Earlier quoted context omitted.

Well, for the first time since the langauge was created you can now do `brew install clojure`, and then `clj` on the commandline and get a repl. I would have loved something that painless when I was learning Clojure.

Not only this, but also things like `clj myscript.clj` are, I think, useful to beginners.

That's very cool, yes!

Re: Clojure 1.9 is now available

#117
post #65

Earlier quoted context omitted.

Clojure is the best option for me, on my own projects, because I like it and I'm more productive in it (this applies to Lisp in general, I suppose) than any other language I've tried. And when I'm working alone, that's all that matters :D Now, when I'm working on a team... I must tell you I live in Florida and if I've ever met another Clojure/Lisp programmer in meatspace I'm not aware of it (and I'd be surprised). In…

Hey, if you're anywhere near Melbourne, check out Swarmify! We use Clojure(Script).

Yea, I'm in Satellite Beach. Think I even interviewed (just a phone screen, really) with Swarmify a couple of years back before I had really gotten into Clojure.

Re: Clojure 1.9 is now available

#119
post #56

Earlier quoted context omitted.

> So long as you have leiningen installed. I’m not sure I understood your comment. Parent’s code block has two lines: the first one installs Leiningen; the second one starts its repl.

What I meant is, so long as you have an updated version of leiningen readily available. This is just another layer in the toolchain to contend with, and since Clojure is built on the JVM, the toolchain is already quite bloated.

leiningen also updates itself.

Re: Clojure 1.9 is now available

#120
post #42

Is clojure.spec a replacement for static typing? I ask because I've taken a look at clojure in the past and generally like what I see, but after moving from JavaScript to TypeScript at work I don't think I can ever return to a dynamically typed language again. Types are just priceless when refactoring, integrating someone else's code with your own or just exploring new libraries or APIs.

Worked with static typing for about a decade primarily with Java in the enterprise. However, I've also used Haskell and Scala which have advanced type systems. I moved to work with Clojure about 8 years ago, and I don't miss types. If I did, I would've gone back to a typed language a long time ago.

My experience is that dynamic typing is problematic in imperative/OO languages. One problem is that the data is mutable, and you pass things around by reference. Even if you knew the shape of the data originally, there's no way to tell whether it's been changed elsewhere via side effects. The other problem is that OO encourages proliferation of types in your code. Keeping track of that quickly gets out of hand.

What I find to be of highest importance is the ability to reason about parts of the application in isolation, and types don't provide much help in that regard. When you have shared mutable state, it becomes impossible to track it in your head as application size grows. Knowing the types of the data does not reduce the complexity of understanding how different parts of the application affect its overall state.

My experience is that immutability plays a far bigger role than types in addressing this problem. Immutability as the default makes it natural to structure applications using independent components. This indirectly helps with the problem of tracking types in large applications as well. You don't need to track types across your entire application, and you're able to do local reasoning within the scope of each component. Meanwhile, you make bigger components by composing smaller ones together, and you only need to know the types at the level of composition which is the public API for the components.

REPL driven development [1] also plays a big role in the workflow. Any code I write, I evaluate in the REPL straight from the editor. The REPL has the full application state, so I have access to things like database connections, queues, etc. I can even connect to the REPL in production. So, say I'm writing a function to get some data from the database, I'll write the code, and run it to see exactly the shape of the data that I have. Then I might write a function to transform it, and so on. At each step I know exactly what my data is and what my code is doing.

Where I typically care about having a formalism is at component boundaries. Spec provides a much better way to do that than types. The main reason being that it focuses on ensuring semantic correctness. For example, consider a sort function. The types can tell me that I passed in a collection of a particular type and I got a collection of the same type back. However, what I really want to know is that the collection contains the same elements, and that they're in order. This is difficult to express using most type systems out there, while trivial to do using Spec.

[1] http://blog.jayfields.com/2014/01/repl-driven-development.ht...

Post reply on HN