Discover your dream Career
For Recruiters

Jane Street's "extremely popular" new OCAML feature is in Python, but not C++

Jane Street's interns all have special projects issued to them, and the electronic trading firm seems to love offering a chance to improve its favorite coding language, OCAML. The most recent example, labelled tuples, is a feature that makes structured data easier to read, and is one that other functional programming languages don't seem to have.

Click here to follow our new WhatsApp channel, and join the over 1,000 finance professionals getting instant news updates straight to their phone 📱

The feature was built by 2024 intern Ryan Tjoa who previously interned at both Hudson River Trading and Meta. In the abstract for an upcoming session at tomorrow's international conference on functional programming, Jane Street says structured tuples allow coders "to give a helpful name to constructed values where labeled function arguments permit giving a helpful name to parameters." Oftentimes, making code as efficient and low-latency as possible can result in hard to decipher code; the new tuple function can make code more readable and documented, thus safer in principle.

Jane Street's coders have apparently taken to the labelled tuple feature in OCAML with enthusiasm. The abstract says "it has proven extremely popular and quickly found wide use in our code base." Nailen Matschke, a Jane Street software engineer of six years, concurs that the feature has seen "rapid adoption."

Tuples, which group multiple pieces of data together under a single value, are in use in other functional programming languages, but not in the same way. C++, for example, has structured bindings, which can unpack tuples into named variables, and do the same for arrays and structures. Structured bindings can be hard to implement across a large code base, as they only exist in the area in which they're declared.

Rust, meanwhile, has tuple structs. These are similar to both named tuples and to structs - which are another type of compound data. However, tuple structs must be defined prior to their use.

Jane Street's abstract seems to suggest the new labelled tuples can be used on the fly, making them more flexible.

Labelled tuples are, however, available in another language: Python. Named tuples were a part of Python 2.6, which released way back in 2008. But Python is often unable to match the latencies achieved by functional programming languages, which have more low-level control.

Have a confidential story, tip, or comment you’d like to share? Contact: Telegram: @AlexMcMurray, WhatsApp: (+1 269 237 3950)Click here to fill in our anonymous form, or email editortips@efinancialcareers.com. Signal also available.

Bear with us if you leave a comment at the bottom of this article: all our comments are moderated by human beings. Sometimes these humans might be asleep, or away from their desks, so it may take a while for your comment to appear. Eventually it will – unless it’s offensive or libelous (in which case it won’t.)

author-card-avatar
AUTHORAlex McMurray Reporter
  • Ch
    Channell
    23 September 2024

    It's already a feature in F# and cross implemented in C#

  • Re
    Red
    6 September 2024

    but I do love C++

  • Re
    Red
    6 September 2024

    C++ is dead

  • Be
    Bernie B.
    5 September 2024

    I am a bit rusty in Rust, but I believe Rust tuple struct are similar to C++ std::tuple.

    C++ structured bindings is a totally different things, and is similar to Python tuple unpacking (note: there is unpacking in C++, related to variadic templates).

    I do not know what ocaml labelled tuple might be (sounds like a "struct"), so maybe someone from Jane Street can explain here how it is similar and/different from any of the above would be helpful.

Sign up to Morning Coffee!

Coffee mug

The essential daily roundup of news and analysis read by everyone from senior bankers and traders to new recruits.

Sign up to Morning Coffee!

Coffee mug

The essential daily roundup of news and analysis read by everyone from senior bankers and traders to new recruits.