News for hackers. Stuff that matters.
Re:OCaml Compiler Hacking: how to add a primitive by rubiquity on Thursday August 06, 2015 @02:40PM (#10018452)
I try and read/comment on all of the OCaml articles that surface here. I've been learning the language for a few months now and I'm having a blast! I'm hoping we can carve out a niche in the infrastructure space for OCaml. It's a really approachable language for the ML family! I hope it grows.

Here's a couple of books I'm enjoying so far:

Think OCaml/How To Thinke Like A (Functional) Programmer - http://greenteapress.com/thinkocaml/thinkocaml.pdf (same author as all the other awesome Think X books!)

Unix Systems Programming in OCaml - http://ocaml.github.io/ocamlunix/

People also say really great things about Real World OCaml but I haven't had a chance to go through it yet.

Re:OCaml Compiler Hacking: how to add a primitive by freefrag on Thursday August 06, 2015 @02:58PM (#10018590)
I also recommend the notes for L28[1] - Advanced Functional Programming at Cambridge. They might be a little hard to follow, but they are extremely insightful and teach concepts that may be difficult to learn elsewhere

[1] https://www.cl.cam.ac.uk/teaching/1415/L28/materials.html

Re:OCaml Compiler Hacking: how to add a primitive by agumonkey on Saturday August 08, 2015 @03:33AM (#10026622)
Indeed, very complete set of slides. Thanks a lot.
Re:OCaml Compiler Hacking: how to add a primitive by haxeny1 on Thursday August 06, 2015 @04:02PM (#10019017)
I first started using ocaml (f# actually and then re-wrote it in ocaml) for writing a simple interpreter to generate java code from mysql schema tables to deal with hibernate boiler plates etc. The code was much succinct than a comparable parser written in say antlr. That was my first introduction to typesafety helping me move forward. Specially, when coming back to the code, the compiler will scream at you for either not handling all the patterns that matched or adding new ones that didnt exist yet and needed to be changed. I went away from OCAML towards Haskell because a coworker convinced me to switch: also haskell seems to have a better support for multicore architectures. Of course, my applications are more web/networking apps, crud, websites etc. So i could have gone either way. The one difference i find when programming with Haskell as opposed to ocaml is that in ocaml, my instinct would be to write a little interpreter(or a quasi quoter). In Haskell, I still think that template haskell is a necessary evil, therefore, do it only when I really know what I am doing. I found this link to be quite helpful: http://pleac.sourceforge.net/pleac_ocaml/
Re:OCaml Compiler Hacking: how to add a primitive by agumonkey on Friday August 07, 2015 @12:18AM (#10020922)
Reading the pleac pages, it's amazing how javascript is getting close and closer to ml. It's all going back to its roots since js was quite {scheme} so it's not that surprising but still a joy to see.

Module.foo (fun (x,y) -> ...) ...

Re:OCaml Compiler Hacking: how to add a primitive by rubiquity on Friday August 07, 2015 @10:30AM (#10022659)
JavaScript and ML couldn't be further apart.
Re:OCaml Compiler Hacking: how to add a primitive by agumonkey on Friday August 07, 2015 @11:48AM (#10023141)
There still far away from each other but js is getting closer. Emphasis on functions, proper scoping, patterns for bindings, IIRC TCO is in ES6, even if it's a small step is already a huge one.

It's still not a typed calculus, but types will be mainstream soon. my 2 cts bet.