1. 14

    1. 3

      Sad but true. As an engineer who works primarily in Ruby I’d really like to see Ruby become statically typed. Unit tests would become much less of a nightmare.

      1. 1

        I have embarked on a: just use haskell for ALL THE THINGS [1] for the past 6 months. Honestly, I’m starting to really really freak out having to use python and ruby or perl or whatever for work. Its kind of weird thinking and going, why is there so much unneeded drama to using classes and ugh. I keep wanting hoogle so I can just find the function that implements the function shape I want. Which is generally always there or if it isn’t it isn’t too hard to build.

        I think my time of taking dynamic languages as the best thing ever is definitely reaching a middle.

        1. 1

          I feel like I’m in the same phase. I read so much about Haskell over that past year or so and recently, I started doing the same thing. Like John Carmack mentioned in his QuakeCon talk: (paraphrasing) “I’ve set out to write my 10,000 lines of Haskell to really learn about it in a practical way.”

          1. 1

            My problem is that I can’t just slip in Haskell code at work… I think I’d certainly ruffle some feathers. :)

        2. 1

          In other words: has Betteridges law of headlined been disproved? No.

        3. 4

          I find debates like this a little funny. I encourage people to be receptive to the value of static types, but the large efforts behind typescript, hack, and flow suggest that it’s no trivial matter at all to add a type theory to a dynlang.

          They are however great examples that type systems can be slotted atop a dynlang as a new UX. I think that is huge. Just don’t expect 99% of the benefits of having a nice and pervasive type theory like Haskell’s to be translated just because you’re aware that an int isn’t a string.

          I’m a little worried that the way this will play out is that the next wave of dynlangs will be armed with the idea that gradual typing is a lot of paperwork without significant benefit and the pendulum will swing back again. I believe that many advantages of types are simply not of the have-your-cake-and-eat-it-too variety.

          But all that said, let me reiterate that I’m incredibly happy to see more noise about formal verification as both a type zealot and a person who’s live is day-by-day consistently and increasingly at the risk of other people’s programmed artifacts.

          1. 2

            Gradual typing is actually pretty cool. See Typed Racket.

            1. 2

              Is it just me or is the world going type crazy? Flow was introduced this past week, now Ruby is talking about static typing…. Its got to be all the popularity Haskell has been seeing lately – everybody wants types now….

              1. 1

                In JavaScript-land, we’ve got three major initiatives which add better typing onto the existing language: Facebook’s Flow, Google’s AtScript, and Microsoft’s TypeScript. I’m intrigued by these, but like you, I wonder if there was something in particular that kicked off this renewed interest.

                1. 1

                  I think types were pretty demonized for a long time since everyone was tired of

                  var FrobbleUnitFactoryManagerFactory frobbleUnitFactorManagerFactory = new FrobbleUnitFactoryManagerFactory();

                  Generally, Java’s type system is “whip and bondage” with relatively little payoff. I believe it’s becoming justified to say that inheritance and subtyping don’t actually play together very well and Java’s lack of inference, higher-order abstraction, and general verbosity did a poor sale on the potential for types.

                  On the other side of the fence, ML-alikes began very early to understand the importance of inference. They also built a type system not on trying to describe the broken abstraction of OO/inheritance but instead from formal logics and proof theory. Arguably, this is a study which has been honed by some of the smartest human minds for over a century at this point. It’s simply a much nicer system with more research and serving much higher goals. It’s just better!

                  So, as more ML-alikes get exposure it’ll be increasingly clear that types don’t have to suck. It’ll even be increasingly clear that good types change programming into an entirely different and more enjoyable experience.

                  Unfortunately, “good types” aren’t easy to do. Slapping some kind of type theory atop a dynlang is going to be its own bag of worms. Given how many dynlangs are out there and how easy it is to just throw a preprocessor on top there’s a good chance that in another 30 years we’ll become quite good at it. I’m really excited by that.

                  But I’m a little worried about things today (as I stated in my other comment here) because I think that the types of TypeScript/AtScript/Flow/Hack are serving two masters with their stated goal of “not being too painful into integrate”. It’s almost certainly the right tradeoff, but I fear that there will be another round of pendulum swinging before “real, mainstream” languages have halfway decent type theories driving development instead of just being fancy, annoying window dressing.

                  Very self-consciously, I say this as a Haskell fanatic who has only ever really had a chance to use TypeScript in anger.

                  1. 1

                    Very self-consciously, I say this as a Haskell fanatic who has only ever really had a chance to use TypeScript in anger.

                    Mind sharing what your experience with TypeScript was like? I’ve been investigating it for use at my company because we’ve been expanding into much richer client-side apps recently, and having an additional mechanism for catching errors early seems like it would be really useful.

                    1. 1

                      I found it was a good way to add typing to Javascript back when it was the only Javascript-like answer. Optional properties are better than unchecked nulls but worse than Maybe. Those were quite wonderful. I used it to throw together a couple React apps and writing sufficient-but-not-comprehensive d.ts files wasn’t a bear. I found that I couldn’t leverage a lot of ML-style typing tricks and the type system is more C# like. I’m not incredibly familiar with C#, but I felt a little put off by the way it handles variance.

                      All in all, I think it’s a well-developed type system for Javascript which is not entirely unlike the Javascript you would write normally. I didn’t have the experience of using the gradual typing system much beyond interfacing with foreign libraries. My proclivity was to “type it or forget about it” so my interfaces with any were minimal. Again, this didn’t seem to cause too much trouble, but I wonder if I had spec’d out a larger d.ts file whether it could have caused issues. I’m quite interested in trying the Flow/React interop that Facebook is clearly quite worried about.

                      So, my final review is that it’s a good system which will help you catch errors. It makes Javascript 1000% better to my eyes. But then the type system itself is a bit warty in order to perhaps “feel like” Javascript and to “feel like” C#. I’m not sure if any Javascript type layer will stop those issues though unless it severely restricts the fragment of Javascript you’re allowed to use and holds third-party libraries much further away.

                      Of late I’ve been trying to poke into things like GHCjs and js_of_ocaml instead, though, to be honest.

                      1. 1

                        So, my final review is that it’s a good system which will help you catch errors. It makes Javascript 1000% better to my eyes. But then the type system itself is a bit warty in order to perhaps “feel like” Javascript and to “feel like” C#.

                        Sounds like it will be a good fit for us, then. Due to the existing codebase and the team composition, we’re constrained to using things that are pretty close to ordinary JavaScript. Thanks for taking the time to answer!