Thoughts on KC's "Foundations for Hacking on OCaml" [thoughts-on-foundations-for-hacking-on-ocaml]
- November 10, 2025
- Patrick Ferris
- https://kcsrk.info/ocaml/2025/11/10/hacking/
KC recently wrote a thought-provoking piece entitled "Foundations for Hacking on OCaml". In it, KC recounts the all to familiar experience of new CS students arriving at complex projects (like the OCaml compiler) and not knowing where to begin.
Speaking from experience, the undergraduate CS course at Cambridge (when I did it between 2017 and 2020) was still very much theory-first. This was true even in courses such as Operating Systems and Optimising Compilers. That's not to say there weren't hands-on aspects (building circuits, programming FPGAs, a group project with an external "client" etc.). But none of this did the "hacking skills" justice. Ryan and I have discussed this at length, in particular how we both seem to have come out the other side of our undergraduate degrees with a healthy amount of "hacking skills". How, in many ways, that has become an integral part of the way we do research. Why is this the case? What could we be doing more of to help students bridge the gap from theory to real-world, complex projects?
Hacking Skills
- November 10, 2025
- Patrick Ferris
What do I mean when I say hacking skills? I'm referring to what KC has called "systems programming".
There are many fundamental systems skills that go into working on a language like OCaml that only come with soaking in systems programming. By systems programming, I mean the ability to use tools like the command-line, editors, version control, build systems, compilers, debuggers, bash scripting, and so on.
KC's choice of words are spot on, you need to soak in the systems programming. I believe, for a lot of CS students, the only way to get comfortable with these kinds of skills is in using them. It is similar to having work experience to complement your theoretical knowledge. As with all work experience, you run into the chicken-and-egg problem of having just enough experience to be considered for a role (be it a job, a PhD, an internship etc.) even though that experience is often gained via the role you're trying to do!
Luckily, I think open-source can play a terrific role in helping bridge that gap. There are countless projects (on Github, Sourcehut, tangled etc.) that need help. With the right amount of documentation, issue triaging and mentoring, open-source projects can often be a great way for students to gain the required hacking skills they need.
Outreachy
- November 10, 2025
- Patrick Ferris
I am one of the OCaml community's coordinators for Outreachy. Outreachy puts all of this into practice whilst recognising that the playing-field is not fair.
Outreachy provides internships to anyone from any background who faces underrepresentation, systemic bias, or discrimination in the technical industry where they are living.
Concretely, there are a few key aspects that make this possible:
The internships are paid. Everyone doesn't have the same affordances to take time out of their schedule to learn "hacking skills" and contribute to an open-source project.
Structured for success. The mentoring provided by open-source maintainers is targeted towards people who likely need some help learning the "hacking skills" needed to succeed. The project is also tailored to the intern.
Encouraging "Hacker" Societies
- November 10, 2025
- Patrick Ferris
A large part of why I feel I developed the systems programming skills I needed was through my involvement with Cambridge's "hackers" society: Hackers at Cambridge (yes, that's a completely custom website built using Swift, h/t to Jared!). The essence of that society was to provide hands-on, practical experience writing real-world software for anybody. This included:
A creative coding workshop I ran using p5.js.
How to use Make.
How to use Docker.
Hackers at Cambridge offered exactly what I needed to be a better programmer. More experienced friends who were willing to sit with you and explain git branches, and a place to channel your own explorations into programming and building systems. Speaking of places to channel your developing skills...
Self-host, self-host, self-host [self-host-love]
- November 10, 2025
- Patrick Ferris
Self-hosting is another great way to build those skills. My website has had at least five different incarnations at this point. Some highlights include when it was completely made with GatsbyJS (when that was the new hottness), when it was a mishmash of OCurrent and Omd, to now, when it is one part Graft and one part Forester.
Before I had a website, I was also blogging on Medium (I won't pretend they were the best blogs ever, but I learnt a lot by writing them). I have since moved past Medium as their values do not align with my own, but it was an important stepping stone.
Thanks to Ryan, who is very generous with his time, I now self-host a variety of services using NixOS.
The OCaml Compiler
- November 10, 2025
- Patrick Ferris
KC's post specifically asked about the OCaml compiler. My third year dissertation, supervised by David Allsopp, asked "what if assembly languages had instructions for functional programming languages" and in particular, OCaml! Hacking on the OCaml compiler is a course in software archaeology for many a younger CS student. Make, sed, awk, autoconf, bootstrapping, the runtime, frontend, git, lexing, parsing etc. Even if you are focusing on a particular aspect of the compiler (for me, it was the assembly generation in the backend) you still bump into a good 80 percent of the machinery that makes the compiler tick.
This is where having a good mentor is invaluable. David took the time to explain the parts of the compiler to me, and suggested some good starter exercises to get me going. Not only that, but David could help with all manners of questions that were vaguely related to the project at hand. From our conversations in early 2020 we have:
Another question I had (whilst trying to install the RISC-V cross-compiler in an Opam switch) is the difference/meaning of:
ocaml-base-compiler <= a compiler?
ocaml-variants <= a compiler?
ocaml <= this is a REPL?
Followed by David helpfully adding 20GB to the root device on the shared server we were using, so I could run some Docker containers! Without an experienced, patient supervisor, this would have been death by a thousand cuts at the time.
Work Experience
- November 10, 2025
- Patrick Ferris
After my undergraduate degree, I worked full-time at Tarides for two years on a range of projects, including ocaml.org, obuilder and ocurrent and Eio. Undoubtedly, this is where I learned the most systems programming, and I am very grateful to have been able to work there. The time taken to learn those skills have paid themselves off now in my own research and day-to-day work. Not everyone will have the same opportunities and affordances (and job market...) to be able to go off and learn about real-world software engineering and systems programming, but if you can, I highly recommend it before jumping back into something like a PhD or research. Working alongside Anil, Kate, Thomas, to name but a few, taught me a lot.
In summary
- November 10, 2025
- Patrick Ferris
Having written all this, I think the upshot is that institutions should be:
Encouraging CS students to be involved in open-source from the jump.
One neat way to do this is to host course material online for students to contribute to (or at the very least look at locally). Poking around Timothy Griffin's compiler construction repo was how I got into OCaml in the first place!
Ensure mentors (be it supervisors, teachers etc.) are adequately supported and compotent for the roles they help with.
Provide opportunities to put some of the theory into practice.
It is great to provide resources (as KC has) but without an avenue for putting that into practice, it is hard to really learn what any of these system programming tools are doing for you.
Cambridge is quite well-suited for this with their supervision teaching structure, I recall having to build a hashmap implementation in C for one of my supervisions only to watch it be kindly torn apart by my supervisor using
valgrindand friends. I think we all learned a lot!