Dia Ḋuit, Gꞃéagóiꞃ is ainm dom agus fáilte go dtí mo ṡuíoṁ gꞃéasáin

Programming as Gaeilge


This might appear a little left-field, but it's always surprised me how the morphology of the Irish language lends itself to programming constructs.

irish.svg

Before I continue, I should point out the inspiration for this post originated with Michal Měchura's excellent article here which touches on the same thoughts

The grammatical quirks of Irish

Irish or Gaeilge is an insular Celtic language spoken in, well, Ireland. From a grammatical perspective, it has some unusual traits that set it apart from other modern Indo-European languages: inflected prepositions, initial consonant mutations, and verb-subject-object word ordering.

While these linguistic aspects can be difficult for language learners, they have certain analogies with programming.

The Copula - An Chopail

Irish has two verbs that correspond to the English "to be". One of which is called "the copula" or is.

A copula is defined as a word that connects a subject and predicate in a relationship of equivalence, i.e. copulates

The copula is primarily used to describe identity or quality in a permanent sense. Depending on its usage, it's either termed a classifying copula or identifying copula.

Classification

The classifying copula construction is used to express a "class membership" relation in Irish.

Irish English
Is dochtúir é He is a doctor
Is múinteoir í She is a teacher
struct Múinteoir {};

int main()
{
    // classification: "í" (subject) belongs to class "múinteoir" (predicate)
    // i.e. "í" is an instance of the class "múinteoir"
    Múinteoir í;
}

Identification

The identifying copula construction is used to express a shared identity between the subject and predicate.

Irish English
Is é an dochtúir é He is the doctor
Is í an múinteoir an bhean The woman is the teacher
struct Identity {};

int main()
{
    // "í" identity object
    Identity í;

    // identification: "an_múinteoir" (predicate) and "an_bhean" (subject) refer to same identity
    // i.e. both variables point to the same "í" object
    Identity *an_múinteoir = &í, *an_bhean = &í;
}

Word ordering - Ord na bhfocal

Irish follows a verb-subject-object (VSO) word ordering:

Verb Subject Object English
Múineann Gaeilge She teaches Irish

This word arrangement maps naturally to a function call:

struct Múinteoir {};

// verb(subject, object)
void múineann(Múinteoir múinteoir, std::string teanga) {};

int main()
{
    Múinteoir í;

    // "múineann" (verb) "(s)í" (subject) "gaeilge" (object)
    // word order preserved
    múineann(í, "gaeilge");
}

So not only does Irish satisfy the syntax of the programming language, it's also semantically and (almost) grammatically correct. Pretty cool.

To use the correct grammar, it should be "múineann gaeilge" using the subject form of the pronoun, , rather than the copula form í introduced earlier

Literally translating "múineann sí Gaeilge" would be "teaches she Irish"

Irish isn't the only VSO language; Welsh, Arabic, and Classical Hebrew all share this ordering and would produce the same mapping. But Irish has a trick that takes it a step further: synthetic verb forms.

In certain tenses, the subject pronoun fuses into the verb ending itself. "Múineann mé" (I teach) becomes "múinim", where the -im suffix encodes the subject. The subject is no longer a separate argument; it's bound into the verb.

That's closer to method dispatch than a free function call:

struct Mé {
    // synthetic: "múinim" - subject fused into the verb
    // like a method where the actor is implicit (this)
    void múinim(std::string teanga) {};
};

int main()
{
    Mé mé;

    // analytic:  múineann(mé, "gaeilge") - free function, explicit subject
    // synthetic: mé.múinim("gaeilge")    - method call, subject is bound
    mé.múinim("gaeilge");
}

Initial mutations - Na n-Athruithe Tosaithe

Irish has a feature that looks bizarre to learners. It's the fact that the first letter of a word can change depending on what comes before it. These initial mutations come in two forms: séimhiú (lenition) and urú (eclipsis).

Séimhiú inserts an 'h' after the initial consonant. Urú prepends a new consonant that "eclipses" the original. Both are deterministic, where the preceding grammatical context dictates which transformation applies.

Trigger Base Result Type
mo (my) bean mo bhean séimhiú
mo (my) cáca mo cháca séimhiú
ár (our) bean ár mbean urú
ár (our) cáca ár gcáca urú

The word's identity doesn't change; only its surface form does. That's a direct analogy to higher-order functions or decorators; a grammatical context wraps a word and transforms its appearance without altering what it refers to.

std::string séimhiú(std::string focal) {
    // lenition: insert 'h' after the initial consonant
    focal.insert(1, "h");
    return focal;
}

std::string urú(std::string focal) {
    // eclipsis: prepend a consonant that overshadows the original
    static std::map<char, std::string> eclipse = {
        {'b',"m"}, {'c',"g"}, {'d',"n"}, {'f',"bh"},
        {'g',"n"}, {'p',"b"}, {'t',"d"}
    };
    if (eclipse.count(focal[0])) focal.insert(0, eclipse[focal[0]]);
    return focal;
}

// "mo" always triggers séimhiú - the context determines the transformation
auto mo(std::string focal) { return séimhiú(focal); }

// "ár" always triggers urú
auto ár(std::string focal) { return urú(focal); }

int main()
{
    // mo + bean → mo bhean (my wife)
    // ár + bean → ár mbean (our wife)
    auto bhean = mo("bean");
    auto mbean = ár("bean");
}

The trigger rules (after mo, do, a (masculine possessive), etc.) are essentially pattern-matching on the preceding token; each context dispatches to a specific transformation.

Prepositional pronouns - Forainmneacha réamhfhoclacha

Prepositions are words such as "with", "for", "at" or "on". Unlike many other languages, these words can be inflected in Irish.

A word like "on" translates to ar. And ar combines with personal pronouns to produce inflected forms:

Pronoun On
me orm
you ort
he air
she uirthi
us orainn
ye oraibh
them orthu

This inflection isn't arbitrary; it's a rule-governed morphological transformation. The forms follow patterns, and the inflection table is better understood as a pure function than a flat enumeration:

std::string ar(std::string pronoun) {
    // inflection as function: preposition + pronoun → inflected form
    // the transformation is productive, not an arbitrary lookup
    static std::map<std::string, std::string> forms = {
        {"mé", "orm"}, {"tú", "ort"}, {"sé", "air"},
        {"sí", "uirthi"}, {"muid", "orainn"},
        {"sibh", "oraibh"}, {"siad", "orthu"}
    };
    return forms[pronoun];
}

int main()
{
    // "cuir" (verb) "agallamh" (object) "air" (inflected pronoun)
    // "put interview on-him" → "interview him"
    auto inflected = ar("sé");  // → "air"
}

As Michal Měchura pointed out in his article, Irish is strongly periphrastic. In other words, Irish places greater emphasis on multi-word constructions to convey meaning rather than using single verbs.

This is apparent in "cuir agallamh air" which literally translates to "put interview on-him". Or in proper English, "interview him" in the imperative sense.

The verbal noun - An Ainm Briathartha

Irish uses the verbal noun for progressive aspect rather than conjugated verb forms. Where English says "she is teaching", Irish says:

Irish Literal English
Tá sí ag múineadh She is at teaching She is teaching

The verbal noun múineadh (teaching) is a reified action, i.e. a noun derived from a verb. It isn't invoked directly; it's passed around with prepositions like ag (at). The action is a value being operated on, not a direct call.

That's closer to first-class functions than anything in the conjugated verb examples:

// the verbal noun: an action reified as a value
auto múineadh = [](std::string teanga) { /* teach */ };

// "ag" receives the action as a value - progressive aspect
template<typename F>
void tá_ag(std::string subject, F verbal_noun) {
    // the subject is "at" the action - it's ongoing
    verbal_noun("gaeilge");
}

int main()
{
    // "tá sí ag múineadh" - the verbal noun is first-class
    // the action is passed to "ag", not called directly
    tá_ag("sí", múineadh);
}

The autonomous form - An Fhoirm Shaor

The autonomous verb drops the subject entirely. No actor is named:

Active Autonomous
Múineann sí Gaeilge (She teaches Irish) Múintear Gaeilge (Irish is taught)

The verb múintear carries no agent. The operation is described without naming who performs it. In functional programming terms, that's point-free style: defining a computation without explicitly binding its arguments.

// active: subject explicitly present
void múineann(std::string subject, std::string object) { /* ... */ };

// autonomous: the subject is erased from the interface
// the operation is described without naming the actor
void múintear(std::string object) { /* ... */ };

int main()
{
    // active: "múineann sí gaeilge" - subject bound
    múineann("sí", "gaeilge");

    // autonomous: "múintear gaeilge" - point-free, no actor
    múintear("gaeilge");
}

The genitive case - An Tuiseal Ginideach

Irish uses the genitive case to express possession. Where English puts the possessor first ("the teacher's book"), Irish reverses the order and inflects the possessor:

Irish Literal English
Leabhar an mhúinteora Book of-the teacher(gen.) The teacher's book

The owned object comes first. The owner follows as a qualified accessor, inflected into the genitive case (múinteoirmhúinteora). Structurally, it's the same nesting relationship as member access in most programming languages:

struct Múinteoir {
    std::string leabhar = "Úrscéal";
};

int main()
{
    Múinteoir an_múinteoir;

    // C++ reads owner-first:  an_múinteoir.leabhar
    // Irish reads owned-first: leabhar an mhúinteora
    // reversed surface order, same structural nesting
    auto leabhar = an_múinteoir.leabhar;
}

Irish genitive ordering is the reverse of English possessive, but mirrors the qualified access pattern most programming languages use: the relationship is expressed through nesting, regardless of which direction you read it.

Conclusion - An Deireadh

What started as a surface-level observation about word ordering turns out to run deeper. Irish distinguishes classification from identification at the grammatical level; so do type systems. Its synthetic verb forms bind the subject into the verb; so does method dispatch. Initial mutations are context-triggered pure transformations; so are higher-order functions. The verbal noun reifies actions as values; so do first-class functions. The autonomous form erases the actor; so does point-free style.

Irish is often treated as archaic or impractical. But its grammatical machinery, the mutations, the verbal nouns, the autonomous form, encodes distinctions that mainstream programming languages took decades to formalise. Both systems solve the same fundamental problem; how to express who does what to whom, unambiguously, in a structured form. Natural languages had a few thousand years' head start. It's not surprising they arrived at some of the same answers.

Date: January 14th at 12:05pm

PREVIOUS NEXT