News for hackers. Stuff that matters.
Re:Experiment: Unit testing isn't enough; You need static ty... by cageface on Wednesday June 20, 2012 @10:04AM (#4136997)
I'm convinced that dynamically typed languages are a transitional technology that will be superseded once we develop type systems that are both usefully strict but also flexible.

After over ten years working in dynamic languages I'm very happy to have a compiler on my side again.

Re:Experiment: Unit testing isn't enough; You need static ty... by ocharles on Wednesday June 20, 2012 @10:33AM (#4137142)
Amen, I've spent the last 3 years of my career working on an increasingly complicated Perl project and frankly, I've had enough. My pet projects now are all Haskell and I can't believe how fun it is.

I spend most of my time these days fixing bugs and regressions due to the sheer scale of the project, and I'm a running meme at work for saying "a type checker could have caught that!". I can't imagine going back to a dynamic language now.

Re:Experiment: Unit testing isn't enough; You need static ty... by MatthewPhillips on Wednesday June 20, 2012 @11:22AM (#4137391)
Are you having fun because you switched to a statically typed language or are you having fun because you switched to a functional language? Would you be having less fun had you chosen Clojure?
Re:Experiment: Unit testing isn't enough; You need static ty... by cageface on Wednesday June 20, 2012 @11:26AM (#4137413)
I started a parallel implementation of a bunch of machine learning algorithms in Clojure and Scala. I figured the Clojure version would pull out ahead thanks to my previous lisp experience and lisp's history in that domain.

I was very surprised to discover that my Scala code was a lot easier to understand and maintain and had fewer bugs.

Re:Experiment: Unit testing isn't enough; You need static ty... by gnuvince on Wednesday June 20, 2012 @12:55PM (#4137839)
What do you attribute this to? The static typing of Scala or the libraries that you use?
Re:Experiment: Unit testing isn't enough; You need static ty... by cageface on Wednesday June 20, 2012 @05:10PM (#4139122)
Definitely typing. I wasn't using any libraries.
Re:Experiment: Unit testing isn't enough; You need static ty... by ocharles on Wednesday June 20, 2012 @01:06PM (#4137886)
You know, I'm probably having fun because of both. I love the type system Haskell gives me for exploring a problem space without diving into a solution. I am enjoying working in a functional language because it forces me to work in really small pieces and slot them together. I try and do this in Perl too, of course, but it can sometimes be easier to just cargo cult some things and forget to come back to them.

I think what I enjoy most is the type system though, and the ability to make massive refactorings until stuff compiles. 9 times out of 10, things just work after that.

Re:Experiment: Unit testing isn't enough; You need static ty... by dochtman on Wednesday June 20, 2012 @11:59AM (#4137565)
Seems to me that that's what static typing proponents have been saying for years (if not decades), and it still isn't true.

That said, I'm currently hacking on a compiler to see if I can come up with a design for a static language that's almost as pleasant to use as a dynamic one, so I'm not completely hopeless. But it certainly seems like the data point that until now no such superior type system (strict but flexible) has become widely popular should not be underestimated.

Re:Experiment: Unit testing isn't enough; You need static ty... by cageface on Wednesday June 20, 2012 @05:24PM (#4139188)
That's because it takes years or even decades to really get this right, like a lot of other sophisticated technology. Look how long it took to get the JVM to where it us today. This is fundamental research and hard stuff.
Re:Experiment: Unit testing isn't enough; You need static ty... by IsTom on Wednesday June 20, 2012 @12:59PM (#4137852)
What you are looking at are not two variables (strict, flexible), but also "ease of use". Arguably dependent-typed languages are most strict, but also most flexible: you can write type of a function that only accepts primes on input. They are hard to use though. Dynamically-typed languages are flexible and easy to use, but not strict. Java-likes are strict and easy to use, but they're very unflexible.
Re:Experiment: Unit testing isn't enough; You need static ty... by swah on Wednesday June 20, 2012 @08:07PM (#4139842)
So we're talking about type inference - which way are you going?
Re:Experiment: Unit testing isn't enough; You need static ty... by gnuvince on Wednesday June 20, 2012 @10:18AM (#4137060)
What dynamic language were you using and which language are you using now?
Re:Experiment: Unit testing isn't enough; You need static ty... by cageface on Wednesday June 20, 2012 @10:25AM (#4137097)
I pretty much lived in Rails from 2004-2011 but did a lot of Python and Perl before that.

These days it's mostly C++/Obj-C but I'm keeping an eye on Haskell for iOS.

Re:Experiment: Unit testing isn't enough; You need static ty... by eta_carinae on Wednesday June 20, 2012 @11:14AM (#4137340)
> I'm keeping an eye on Haskell for iOS.

Really? Is that even possible? Can't imagine Apple being okay with that.

Re:Experiment: Unit testing isn't enough; You need static ty... by cageface on Wednesday June 20, 2012 @11:24AM (#4137398)
They've significantly relaxed their restrictions on iOS languages. It's not any weirder than running C# binaries via Mono.
Re:Experiment: Unit testing isn't enough; You need static ty... by gsnedders on Wednesday June 20, 2012 @11:21AM (#4137374)
Apple's fine with such things… provided you don't let arbitrary code run in your system. If all your VM/runtime runs is what is in the application, it's fine.
Re:Experiment: Unit testing isn't enough; You need static ty... by gaius on Wednesday June 20, 2012 @11:34AM (#4137449)
Sure, GHC is on ARM now.
Re:Experiment: Unit testing isn't enough; You need static ty... by akkartik on Wednesday June 20, 2012 @12:20PM (#4137669)
I haven't heard of anybody suggest that static languages should allow lists to contain arbitrary types. Hmm, do tuples cover all the use cases for that feature?
Re:Experiment: Unit testing isn't enough; You need static ty... by IsTom on Wednesday June 20, 2012 @01:13PM (#4137934)
If you want a list of heterogenous "things" you either a list of "I don't care about what's on list" and then it should work without much in languages like Haskell, ML and the rest or you actually have list of things with a common property, such as "I want to be able to turn these things into strings and sum them" or "These are either numbers or strings" -- all functional languages work well with the latter through ADTs and the first one can be solved easily in Haskell with existential types (I don't know about other languages)
Re:Experiment: Unit testing isn't enough; You need static ty... by zemo on Wednesday June 20, 2012 @10:47AM (#4137217)
>type systems that are both usefully strict but also flexible.

that's basically the design criteria behind Go's type system.

Re:Experiment: Unit testing isn't enough; You need static ty... by Peaker on Wednesday June 20, 2012 @12:29PM (#4137711)
I think Go's type system is decades behind the state of the art. I can't believe they repeated the mistake of Boolean Blindness [1]. Sum types and pattern-matching are crucial for useful strictness with flexibility. This results in funny things like encoding the optional error result in Go as a type product rather than a sum, allowing reading of a result even if it does not exist due to an error.

[1]: http://existentialtype.wordpress.com/2011/03/15/boolean-blin...

Re:Experiment: Unit testing isn't enough; You need static ty... by zemo on Wednesday June 20, 2012 @03:23PM (#4138672)
...your problem with Go is that it has a boolean type?
Re:Experiment: Unit testing isn't enough; You need static ty... by Peaker on Thursday June 21, 2012 @04:09AM (#4141005)
No, did you read that article?

My problem with Go is that it does not have sum-types and pattern-matching. This means that branching (conditionals) in Go do not gain any type-information. And that means that programmers have to manually keep track of the invariants that hold true in each of their conditionals, and if they get them wrong, they get no help from the compiler.