4 ms·
I want Go but with a really strong static type system. What do I use? Haskell's Hackage seems to be full of broken packages. OCaml seems to be stuck in 1999.
by peterhunt 12y ago
I want Go but with a really strong static type system. What do I use?
Haskell's Hackage seems to be full of broken packages.
OCaml seems to be stuck in 1999.
F#/Mono is pretty great, but tough to find quality libraries that work with the tools I use (postgres etc)
Anything I'm missing?
- deleted 12y ago[deleted]
- DCKing 12y agoScala? Strong static types, lots of quality libraries both for Scala and 'inherited' from Java. Fits well among the languages you already mention.
- peterhunt 12y agoNice. I've heard some complaints about compile times -- are they founded?
- mhax 12y agoYep. Compile times are comparatively long - the larger the project, the more this is an issue. For me it's not a deal breaker.
- DCKing 12y agoThere's a difference between "the language has long compile times" and the implied "you spend a lot of time waiting during development". It is true that Scala's compile times are long, but the tooling provides ways so that you don't have to wait so much during development.
- th0br0 12y agoScala 2.12 will have a new compiler backend which should speed things up considerably. [1] Other than that, as an avid Scala fan, I've been long wondering why people favour Go so much. Arguably, if you've started out with RoR, then Node.js was a great improvement (dynamic typing with awesome speed). Then came Go, which solves many of the issues you tend to encounter with Node.js. So now, after it has reasonably matured, many people are pivoting to it. Scala, while having a rather "bloated" core library (i.e. quite exhaustive), already does most that Go does (i.e. an Actor is reasonably close to a goroutine etc.) and has an awesome type system. But then, I'm biased and YMMV ;) [1] https://magarciaepfl.github.io/scala/ https://magarciaepfl.github.io/scala/
- randallsquared 12y agoCompared to Scala, Go is incredibly simple, both to learn and to use. If you don't have a lot of experience with Java and the JVM, Go also avoids that whole avalanche of complexity, apart from Scala itself.
- DCKing 12y ago> Compared to Scala, Go is incredibly simple, both to learn and to use. Probably true. Go has a far more simple language specification, but it's not as if Scala is particularly alien. > If you don't have a lot of experience with Java and the JVM, Go also avoids that whole avalanche of complexity, apart from Scala itself. Why is Java or the JVM an 'avalanche of complexity' for Scala?
- randallsquared 12y agoI meant only that if you want to use Scala, you'll inevitably have to also know Java. It's two languages for the benefit of one. The JVM comes with its own issues: which JDK do I use[1]? What happens when one library I want to use recommends a different JDK than another library I want to use? Build tools questions: ant, maven, gradle? Oh, I need to learn Groovy, too? Three languages for the benefit of one. Yay. There's just an enormous amount of stuff to learn, and most of it is required-but-incidental; none of it (except Scala, in our example) is an inherently necessary part of getting from learning to a production system running Scala on the JVM, but you will end up having to become conversant with many of these things, and probably dozens of similar infrastructure and tooling systems. [1] Haha. I was thinking this was mainly between Oracle's and openjdk, because that's what seems easily available, but it looks like there are four or five currently updated JVMs: http://en.wikipedia.org/wiki/Comparison_of_Java_virtual_machines http://en.wikipedia.org/wiki/Comparison_of_Java_virtual_mach...
- DCKing 12y agoNow I don't know if it's intentional or not, but many things you are saying are just FUD. You seem to be assuming that the only way to do JVM stuff is considering all the difficulties that enterprise Java shops with legacy projects put up with. That is far from the truth, as any tutorial for Spray, Play or Akka could tell you. > Which JDK do I use[1]? The Oracle JDK (which is the same as OpenJDK FYI). > What happens when one library I want to use recommends a different JDK than another library I want to use? There is a 3-month period or so every three years when a new major Java release is done when some developers of enterprisy libraries might want to do some more testing before making a recommendation. It's not a big question in the JVM world at all, and it's definitely not a big problem even for early adopters. > Build tools questions: ant, maven, gradle? SBT. You're building a new Scala project. > most of it is required-but-incidental; none of it (except Scala, in our example) is an inherently necessary part of getting from learning to a production system You would have been right five years ago. Today, many people run Akka/Spray/Play projects in production just fine without deeper devops knowledge necessary than with other runtimes.
- jackyb 12y agoAs far as I know, Go already has a really strong static type system (int32 cannot be assigned to int for example). Which parts are weak?
- AlisdairO 12y agoI assume they meant strong as in 'good' - presumably they're talking about generics.
- cgag 12y agoNo generics (parametric polymorphism), no algebraic data types. You should learn some Haskell or Ocaml even if you don't plan on using it in production. Go's type system is weak. Edit: I don't think there's anything like type classes either but I'm not 100%.
- peterhunt 12y agoYeah, I mainly want to get a feel for building a real system using a strict type system and algebraic data types. I've done some toys with them but nothing real yet.
- Kiro 12y agoWould you consider JavaScript's type system strong?
- deleted 12y ago[deleted]
- otikik 12y ago> Go's type system is weak. It is strong enough for me. I see the lack of algebraic data types and type classes as a feature, honestly. It means I can learn the things I need and start working in 2 days instead of in 2 weeks or a month. I sometimes need generics, but not frequently enough to miss them. You think Go's type system is weak. I think Haskell's type system is overcomplicated. So, there.
- 12y ago
- dons 12y ago> full of broken packages. Citation needed. Hackage goes to great lengths to validate packages as much as possible. Other support systems do continuous integration and further validation, if you're looking for well regarded package subsets. Maintaining 6000+ open source packages is a pretty serious task.
- peterhunt 12y agoI dunno, I tried installing snap, yesod and happstack (the three top web frameworks apparently) about a month ago and after about 20 minutes of compiling all failed to install (some had missing packages, others had the packages but they failed to build). I'm running a no-frills MBP with bash, which I would imagine is a fairly popular dev environment. All I want to do is serve an HTTP request.
- cgag 12y agoI think you should figure out what's going on with with your dev environment and go with Haskell. Are you using the Haskell platform? If so I would ditch that and make sure to install everything in a sandbox, I've had very little trouble with cabal since I went with just cabal + sandboxes. I'm on linux but Chris Allen's guide has instructions for a minimal OSX install: https://github.com/bitemyapp/learnhaskell https://github.com/bitemyapp/learnhaskell If none of that helps, come to freenode #haskell, those packages really should work.
- peterhunt 12y agoOK, you gave me the encouragement to try it again. I ran into a bunch of bugs getting haskell platform set up correctly on OSX (wouldn't remove my old version, had to manually remove GHC, also reported this one https://github.com/haskell/cabal/issues/1980 https://github.com/haskell/cabal/issues/1980) but after reinstalling Haskell platform it seems to be working better. Thanks.
- marcosdumay 12y agoIf you are using the GHC and Haskell-Plataform provided by your distro, I'd recommend you get the latest version and install it yourself. Both are changing a lot and some distros (Debian, for example) do not keep up. (Also, that'll avoid a few severe bugs GHC had up to a few years ago.)
- silentOpen 12y agoYou're missing that OCaml isn't stuck in 1999. OCaml now has an excellent package manager, cool new features, lots of system libraries, and a growing community. What do you find out-dated about it? Check out http://www.realworldocaml.org http://www.realworldocaml.org
- peterhunt 12y agoI want to serve a JSON response over HTTP, preferably from a standalone server (like django etc). Later I want to talk to Postgres and memcached. Do I use this thing? http://ocsigen.org/ocsigenserver/ http://ocsigen.org/ocsigenserver/ All the docs either don't do what I'm looking for (i.e set up a web server to serve some static files) or are broken links! OCaml is actually what I'd prefer to use (since I had a blast with SML/NJ) I'll check out that book, thanks! But I did just skim the ToC and it has nothing about serving HTTP. Serving HTTP is like my #1 use case for anything these days :/
- lpw25 12y agoI think all the pieces are there to do that (e.g. cohttp, yojson, atdgen, PG'OCaml), although perhaps not in a single easy to use framework. Maybe http://rgrinberg.com/blog/2014/04/04/introducing-opium/ http://rgrinberg.com/blog/2014/04/04/introducing-opium/ is relevant.
- djs55 12y agoFor HTTP I always use 'ocaml-cohttp' (opam install cohttp): https://github.com/mirage/ocaml-cohttp/blob/master/examples/async/hello_world.ml https://github.com/mirage/ocaml-cohttp/blob/master/examples/... For JSON I normally use 'Jsonm' but I've heard good things about 'Ezjsonm': https://github.com/samoht/ezjsonm https://github.com/samoht/ezjsonm I've not personally tried them but 'postgresql-ocaml' and 'ocaml-memcached' look plausible.