News for hackers. Stuff that matters.
Re:Plans for OCaml 4.08 by jdonaldson on Wednesday July 04, 2018 @04:06PM (#17459195)
OCaml is a great pick for folks wanting to broaden their understanding of prog languages. It has its own set of sensibilities (Fp with some imperative features thown in, rather than the other way around). It'll force you to get really good with ADTs, which is a good thing.
Re:Plans for OCaml 4.08 by krick on Wednesday July 04, 2018 @05:49PM (#17459608)
Is there something you'd recommend for a person who wants to learn OCaml? Maybe some book that has great exercises, or just a toy-project example for which OCaml would be a much more "natural" pick than other languages?
Re:Plans for OCaml 4.08 by donut2d on Wednesday July 04, 2018 @08:35PM (#17460179)
I recently got into OCaml (and ReasonML) and wrote a blog post with my experiences. In it I recommend several resources for both languages and explain some stuff that wasn't obvious to me as a beginner:

http://donut2d.tumblr.com/post/171205516399/my-experiences-b...

But if nothing else, be sure to check out Real World OCaml[1]. It's pretty great and helped me out a lot getting started.

[1]: https://dev.realworldocaml.org

Re:Plans for OCaml 4.08 by PirateBay on Wednesday July 04, 2018 @05:55PM (#17459633)
If you want to wait a little, the "Real World Ocaml" book is being re-written. It's in beta-ish right but it looks like it would be usable.

Though the core language is the same, some of the language metaprogramming features have been totally switched out for other (better) ones. And it uses the modern versions of the Core (note, that is NOT the standard library) library.

Re:Plans for OCaml 4.08 by laylomo2 on Wednesday July 04, 2018 @07:41PM (#17460006)
Check out dev.realworldocaml.org
Re:Plans for OCaml 4.08 by jdonaldson on Wednesday July 04, 2018 @08:23PM (#17460131)
Yes, this would be the book I would recommend as well. I'll give a bunch of general advice as well:

OCaml is pretty old (introduced a year after Java IIUC), and it contains quite a few crusty libraries and programming patterns that come from age. Stick with the latest version you can find through this "modernization" process headed up by JS.

I'm on 4.06, which just made immutable strings a default, and broke a ton of libraries. If you run into a broken lib, this recent version change is almost certainly the reason. I strongly recommend 4.06 as a minimum version (if you're not working with legacy code). If there's a library you want to use that is not compatible yet, bug the maintainer to update it. I've run into problems trying to downgrade/upgrade my compiler version + all the tools. I can't recommend doing that, it kinda ruins the experimentation experience.

What else can I say? Opam, the package maintainer, is great. There's a great build system, nice IDE support with a set of tools called merlin, and the compiler is super fast. The compiler field-level error messages are generally helpful (typo-fix suggestions), but can be fiendishly opaque if you happen to mess up a match boundary (which can happen easily when mixing in if/then/else statements).

Most stuff is google-able, but there's a lot of "line noise" in OCaml function signatures - especially for variant types and labeled arguments. That's harder to search for, so read that section thoroughly in the book.

Re:Plans for OCaml 4.08 by brohee on Thursday July 05, 2018 @03:28PM (#17466071)
OCaml was really born as Caml Light, in the early 90s..., it's soon to be 30 years old.
Re:Plans for OCaml 4.08 by emmelaich on Friday July 06, 2018 @04:55AM (#17469937)
You could argue it started in 1973 as ML

https://en.wikipedia.org/wiki/ML_(programming_language)

Re:Plans for OCaml 4.08 by brohee on Friday July 06, 2018 @05:01PM (#17475073)
Yeah but in this case it was really just a name change, the team that worked on Caml Light renaming it OCaml as they added more features, and stopping working on Caml Light shortly after.
Re:Plans for OCaml 4.08 by PirateBay on Wednesday July 04, 2018 @11:11PM (#17460621)
Well yes, that's the re-write I'm talking about.
Re:Plans for OCaml 4.08 by cpeterso on Wednesday July 04, 2018 @08:13PM (#17460109)
Facebook's Reason ML might be a more approachable introduction to OCaml concepts. Reason adds a cleaner, more JavaScript-like syntax on top of the OCaml compiler backend.

The Reason team's primary focus appears to be compiling Reason/OCaml to JavaScript. It's a nice language, but I'm not sure why they want to pass through a OCaml "middle end" before emitting JavaScript output. Why not just write a direct Reason->JavaScript compiler similar to TypeScript?

https://reasonml.github.io/

Re:Plans for OCaml 4.08 by donut2d on Wednesday July 04, 2018 @08:32PM (#17460170)
Reason is just a dialect of OCaml and actually uses the BuckleScript[1] compiler, which before ReasonML, just took OCaml code and transpiling it to JavaScript. It's known for being super fast and generating fast and small JavaScript. But you can compile ReasonML to native binaries as well, not just JavaScript, using the BuckleScript compiler or others like jbuilder[2].

The advantage of having OCaml as the foundation is its excellent type system. It's very mature.

I'm relatively new to OCaml, just getting into it this year, but I've found that it forces me to write correct code first. I've been really impressed by it having come from the world of PHP/JavaScript/Swift and others.

Personally, I greatly prefer OCaml's syntax to Reason's. I find it much simpler, and less busy. But I know a lot of people are more comfortable with Reason's syntax. I definitely wouldn't call it "cleaner", though.

[1]: https://bucklescript.github.io [2]: https://jbuilder.readthedocs.io

Re:Plans for OCaml 4.08 by thedufer on Wednesday July 04, 2018 @11:17PM (#17460644)
There is no "OCaml middle end". Reason is parsed into the same AST as OCaml, and then passed through the rest of the OCaml compiler.