đź’ľ Jargon

…or "Nostalgia and a free hour are a bad combination."


#jargon #rust

Jargon, do you grok it?

I recently had a weird conversation on Teams (yes, we use Microsoft Teams at work; don't judge us); triggered by a question in a recent Postman user-survey, it prompted a discussion around "unique terminology" in sofware development and to what degree each of us had been exposed.

Not long after, I ended up referencing a phase of the moon issue with a colleague, with regard to some particularly erratic behaviour we were seeing.

I couldn't help but feel a little nostalgic, harkening back as it did to reading the Jargon File back in the day. Back at University, I used to have a copy of The New Hacker's Dictionary on my shelf and would pore over its entries, hoping some profound knowledge would rub off in some weird form of osmosis twixt me and the hackers of yore. Spoilers: it didn't.

"Jargon" of any kind has an important place, whether in a culture or a profession, insofar as it invariably carries a loaded and precise meaning to those "in the know". It's that last part that arguably has most significance, as not only is the meaning important but also the weird sociological distinction—there's something innately exclusionist about its use.

Sociological musings aside, I was on a nostalgia trip.

"Don't kiss an elephant on the lips today."

Everyone remembers fortune, right?

$ fortune
A few hours grace before the madness begins again.

Way back when I first used Linux (over 20 years ago now; Red Hat, before it gained its Enterprise suffix) something akin to the above would appear every time I logged in. It was strange, utterly alien to everything I'd know before, and I loved it.

So I wanted to throw together something that would spit out entries from the Jargon File, in the style of fortune and its ilk.

Using Rust, natch.

The Jargon File

The most recent version which can claim provenance from the original Jargon File is now sadly defunct. Thanks, however, to the wonderful folks at the Internet Archive, it's been preserved here.

Although the content is more than worth your time, the HTML isn't particularly well structured, making parsing difficult.

What to do? Python and Beautiful Soup? Too much code.

Use sed to strip the HTML tags? Well, that works but checking for multi-line tags feels like too much effort.

Use lynx to dump the text? Everyone has a headless browser, right?

lynx \
    --dump \
    --width 120 \
    --nonumbers \
    ${INTERNET_ARCHIVE_URL} > jargon.txt

That gives us a nice, parsed version of the original page with which to begin.

A while ago, after getting rather bored, having cranked out a dozen POJOs for a project, I ended up outsourcing my efforts to a Python script. With a handful of lines and some configuration, I had the whole lot completed in a fraction of the time.

Drawing on that earlier laziness inspiration, I tried the same here. Having defined a simple struct to hold each entry:

pub struct Jargon {
    pub term: &'static str,
    pub definition: &'static str,

…I wrote some Python to parse the jargon.txt file and generate hard-coded instances for each entry.

However, wanting to dig a little deeper into how Rust might enable me to do this entirely in its own space, I started looking at Build Scripts.

The initial attempt is ugly but you can see it here. The build script effectively serves the same purpose as the Python code, generating the appropriate lib.rs file at compile time.

It's inelegant at best and (again with the nostalgia) reminds me of the large, unstructured blocks of code I used to churn out when I was first thumbing through The New Hacker's Dictionary.

There's further work needed, certainly on getting to grips with the code, but also the entire lynx step can likely be dropped—I'd initially been wary of include the Jargon File's contents in the repo. itself, failing to note that second paragraph where it's explicity stated that it "is in the public domain".

Maybe it'll even get published as a crate (though it took me long enough to publish anything on PyPI, maybe that can wait a little longer.)


That's it. Clone the repo. and cargo run --release. It'll randomly select one of the entries at runtime and print it, Ă  la fortune.

If you're also joining me on my nostalgia trip, you could even use cowsay:

$ jargon | cowsay
/ gronk out vi.                                                  \
|                                                                 |
| To cease functioning. Of people, to go home and go to sleep. "I |
\ guess I'll gronk out now; see you all tomorrow."               /
       \   ^__^
        \  (oo)\_______
           (__)\       )\/\
               ||----w |
               ||     ||