Re: Java like static typing for Clojure?

2016-11-08 Thread Mikera
In my moments of insanity / hammock time I've toyed with making a typed variant of Clojure. Somewhat inspired by core.typed, but I feel that to be effective a type system needs to be deeply integrated with the compiler and standard library, not just a standalone tool. Types would themselves be

Re: Java like static typing for Clojure?

2016-11-05 Thread Didier
Spectrum (https://github.com/arohner/spectrum) seems quite interesting. I haven't tried spec yet, but form quick glance, it looks just as annoying as typed clojure to use. I think I'm imagining something simpler though. Say a system that just used already existing Clojure type hints, and

Re: Java like static typing for Clojure?

2016-10-23 Thread Timothy Baldridge
>> but I might end up needing users with e.g. genuine Norwegian addresses. I think that's an interesting point, and it's a problem I've encountered several times myself. However I think it can be solved several ways. 1) If your validation function "norwegian-addr?" is a simple predicate, then

Re: Java like static typing for Clojure?

2016-10-23 Thread Erik Assum
Colin, I think the points you bring up here are very interesting, and reflect ideas that I have not yet been able to formulate. I certainly would think there is enough "stuff" in here for a talk, and also some ideas into how to grnerative test "bread and butter" code, as can I, and if so,

Re: Java like static typing for Clojure?

2016-10-22 Thread Colin Fleming
Yes, that is a major selling point. Generative testing is really cool, and you should definitely not be disheartened - it's a tool like any other, with its strong points and weak points (like static typing, too). It's definitely not universally applicable, and even more than standard testing, it

Re: Java like static typing for Clojure?

2016-10-22 Thread Colin Yates
Generative testing is great but defining the contract gets more complex the further away from a 'unit' you get. It is easy to define extensive generators for (defn length [s]). It is a much bigger problem to generate extensive inputs for every call-site of (length) and then every call-site of the

Re: Java like static typing for Clojure?

2016-10-21 Thread Daniel
> In this sort of situation, a static type system which provides universal > guarantees (this value can never be null) is more useful than a contract > system (no null values have been seen yet for the test inputs you've tried). > There's simply no way I can test all combinations, or reproduce

Re: Java like static typing for Clojure?

2016-10-21 Thread Daniel
> In this sort of situation, a static type system which provides universal > guarantees (this value can never be null) is more useful than a contract > system (no null values have been seen yet for the test inputs you've tried). > There's simply no way I can test all combinations, or reproduce

Re: Java like static typing for Clojure?

2016-10-21 Thread Antonin Hildebrand
You could travel to the future and use ClojureScript with Kotlin as compilation target and a version of clojure.spec which resolves a subset of known constructs to Kotlin type annotations at compile-time :-p Actually that idea of having a library of compile-time-recognizable spec constructs

Re: Java like static typing for Clojure?

2016-10-21 Thread Colin Yates
Ironically I ran into an issue where I was receiving "" instead of nil which caused some interesting behaviour. For those who find these things interesting, this was for capturing criteria in the UI which was sent to the server to filter. The behaviour was: - form is nil, server ignores the

Re: Java like static typing for Clojure?

2016-10-21 Thread Sean Corfield
On 10/21/16, 10:40 AM, "Colin Fleming" wrote: > Honestly, the easiest solution to my problem is probably just to use Kotlin, > which was > designed by JetBrains for almost exactly my use case, has great IDE support, > and has

Re: Java like static typing for Clojure?

2016-10-21 Thread Colin Fleming
Absolutely, both that and the dogfooding are compelling arguments :-) On 21 October 2016 at 20:04, Colin Yates wrote: > "making me sad" is unsustainable - problem solving with 1s and 0s is > hard enough as it is without using demotivating tools :-). > > On 21 October 2016

Re: Java like static typing for Clojure?

2016-10-21 Thread Colin Yates
"making me sad" is unsustainable - problem solving with 1s and 0s is hard enough as it is without using demotivating tools :-). On 21 October 2016 at 18:40, Colin Fleming wrote: > I tried it a couple of years ago, and my impressions were more or less the > same as

Re: Java like static typing for Clojure?

2016-10-21 Thread Colin Fleming
I tried it a couple of years ago, and my impressions were more or less the same as CircleCI's here . I found the type annotation burden much higher than using a typed language such as Kotlin, the type checking was very slow and the

Re: Java like static typing for Clojure?

2016-10-21 Thread Josh Tilles
Out of curiosity, did you try Typed Clojure? It certainly has its rough edges, but you sound willing to bear the burden of annotating code with types (at the top-level, at least) and I *think* its treatment of Java interop does what you want: unless instructed otherwise, the typechecker

Re: Java like static typing for Clojure?

2016-10-21 Thread Colin Fleming
Sure, I'm not arguing that all large projects suffer from this, and I'm not entirely sure why Cursive does so badly. But the argument I often see online is the opposite - that Clojure codebases never suffer from this, and if they do then it must be because of interop, or the application must be

Re: Java like static typing for Clojure?

2016-10-21 Thread Alex Miller
Just as a counter-anecdote, I have worked on large Clojure codebases (both ones I developed and ones I was unfamiliar with), including ones that interfaced with existing Java codebases, and have not experienced this problem to the degree you describe Colin. So while I believe these problems

Re: Java like static typing for Clojure?

2016-10-21 Thread Colin Fleming
This is a discussion that I've had a couple of times. I don't think that interop is the main factor here, I think it's more that I'm programming against a large codebase I don't understand well (I can't since it's around 4 million LOC). I suspect that if I were programming against a large

Re: Java like static typing for Clojure?

2016-10-20 Thread Daniel
Just curious... What do you think the primary contributing factor is for Cursive's NPEs? Java interop? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are

Re: Java like static typing for Clojure?

2016-10-20 Thread Colin Fleming
I recently spent a bunch of time researching exactly this. My motivation was that my main project, Cursive, suffers from a ton of NPEs which I find very difficult to manage. I wanted to see how difficult it would be to have a typed Clojure-like thing, using something similar to Kotlin's type

Re: Java like static typing for Clojure?

2016-10-17 Thread Colin Yates
Thanks Sean. On 17 October 2016 at 19:21, Sean Corfield wrote: > We have 1.9 Alpha 13 in production. > > We’ve had nearly all the 1.9 Alpha builds in production. After all, right now > 1.9 = 1.8 plus clojure.spec with some minor additions to clojure.core (new > predicates).

Re: Java like static typing for Clojure?

2016-10-17 Thread Sean Corfield
We have 1.9 Alpha 13 in production. We’ve had nearly all the 1.9 Alpha builds in production. After all, right now 1.9 = 1.8 plus clojure.spec with some minor additions to clojure.core (new predicates). Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN An Architect's View --

Re: Java like static typing for Clojure?

2016-10-17 Thread Colin Yates
I have finally found time to watch Stu's video. It was very useful introducing clojure.spec (even if I thought he over-egged the pudding somewhat ;-)). I know there is a back port, but are there any other strategies of using this on 1.9 and building against 1.8? I was thinking of building a tower

Re: Java like static typing for Clojure?

2016-10-17 Thread Stephen Lester
Hi there! There is an 'optional type system' for Clojure in 'core.typed': https://github.com/clojure/core.typed But it also seems like others who were using such a type system have stepped away from it: https://circleci.com/blog/why-were-no-longer-using-core-typed/ On 10/15/2016 03:14 PM,

Re: Java like static typing for Clojure?

2016-10-17 Thread Timothy Baldridge
I highly recommend this talk on Spec by Stu Halloway. Spec is a new feature coming in Clojure 1.9, and this talk goes into the pros/cons of static typing and tests and shows how there can be a better way. https://www.youtube.com/watch?v=VNTQ-M_uSo8 On Sun, Oct 16, 2016 at 5:58 PM, Alan

Re: Java like static typing for Clojure?

2016-10-16 Thread Alan Thompson
Be sure to check out Plumatic Schema (previously Prismatic Schema) if you haven't already. There is also a good Clojure Conj video from 2013. Alan On Sat, Oct 15, 2016 at 3:14 PM, Didier wrote: