Reposturgeon and Santa Claus Against The Martians!

Here’s a late New Year’s gift for all you repository-editing fiends out there: the long-awaited and perhaps long-dreaded reposurgeon 3.0.

In Heads up: the reposturgeon is mutating! I described the downside of a strategy of incremental small language changes aimed at preserving compatibility: you can wind up trapped by suboptimal early decisions. Sometimes, you have to bust out and do the big redesign, which I did and why there’s a bump in the major version number (the last time that happened was when reposurgeon got the ability to read Subversion dump files directly).

The biggest change is that the command language syntax has mutated from VSO to SVO. What? You’re not up on your comparative linguistic morphology and gave no idea what I’m talking about? That’s Verb-Subject-Object to Subject-Verb-Object.

Before 3.0 the order of syntactic elements in a command was: action verb first, then (for most commands) an event selection set, then (for some commands) an object like a directory or repository name. Now the selection set always comes first, followed by the action verb, followed by any object-like arguments.

This change makes the syntax more regular and easier to describe. Easier mainly because there is no longer any of the previous confusion, when a selection set was present after the command verb, over what the first argument of the command was. The selection set, or what came after it? (Correct answer: what came after.)

In making this change I am moving closer to a Unix design archetype that had already influenced reposurgeon pretty heavily: ed(1). ed had a horrendously awful UI by modern standards, but it was (and still is) great for scripting. If you think of ed as a record editor for which the records are text lines, and study its selection syntax, the influence – and the reasons ed makes a useful model for what reposurgeon is doing – should be obvious.

A significant new feature is that reposurgeon now has a user-definable macro facility. I have written in the past that these are generally a bad idea and I still think that’s true in general. (One representative major problem with them is that when macro expressions cross certain kinds of syntactic boundaries in the base language they often become a serious impediment to readability and maintainability.)

But I found I wanted macros while converting the groff repository, and reposurgeon’s base language is simple in some ways that make the obscuring effect of macros less dangerous. There are no analogs of the “++” postfix operator which in C makes “#define square(x) (x)*(x)” such a wonderful way to generate unanticipated side effects. (Hint: consider what happens when you say “square(a++)”. How many times will a be incremented, again?)

Many small irritations in the language have been fixed. “delete” now really means delete and is no longer overloaded with several variants of a commit-squashing operation; that is now “squash”. (Yes, this adopts some git terminology.)

Pathset syntax is now simpler and more powerful. For starters, pathsets now match not only commits touching matching paths but the content blobs that the paths point at (you can select either subset by qualifying with the =C or =B selectors). This is particularly useful in connection with the ‘filter’ command, which allows you to modify comments and blobs by passing them through a user-specified filter.

There are lots of other changes as well. If you have worked with reposurgeon before you’ll have a bit of relearning to do. Sorry about that, but experience has taught me that (when you can get away with it at all) one big, obvious compatibility break is kinder than a long-drawn-out series of little ones that leave everybody wondering what the feature set of the week is,

6 thoughts on “Reposturgeon and Santa Claus Against The Martians!

  1. [1] For those with some linguistic background, SVO is the most common order for the Romance languages, German, and Russian. Japanese is SOV, and English uses all three, but is primarily SVO. (There are many messy details..) So one could argue that changing reposurgeon’s syntax to SVO somehow better “matches” how most hackers already think.

    [2] I would argue, non-strenuously, that ed‘s UI was not “horrendously awful”, even by modern standards, if you accept the limitation that it is a line-oriented editor designed to be run on line-oriented terminals (no curses) at very low baud rates. (My first experience with it was on 1200-baud “glass TTYs”, and it worked pretty well for that thin UI paradigm.)

    [3] In re: “one big, obvious compatibility break” – never forget flag day!

  2. >[1] For those with some linguistic background, SVO is the most common order for the Romance languages, German, and Russian. Japanese is SOV, and English uses all three, but is primarily SVO. (There are many messy details..) So one could argue that changing reposurgeon’s syntax to SVO somehow better “matches” how most hackers already think.


    German departs from SVO more than English does, to the point that you’ll hear (IMHO flawed) arguments that it’s primarily SOV.

    So if you’re throwing German into the list of languages whose most common order is SVO without mentioning that there are messy details (which I applaud), you can safely throw English into the same list.

  3. German and English use a variety of orders, but in declarative present-tense sentences, they’re generally SVO. German is complicated by having certain verbs with “separable prefixes” that are generally equivalent to English “phrasal verbs” (that some grammarians call a verb plus a particle).

    Helga: “Ich gehe morgen einkaufen auf dem Ku’damm. Kommst du mit?”
    Inge: “Ja, ich möchte mitkommen.”

    The verb “mitkommen” separates into two parts, resulting in something remarkably similar to the idiom “Are you coming with?” that causes a reflexive reaction against “ending a sentence with a preposition” (“with”) until it’s properly understood that “come with” in this case is a phrasal verb not unlike “shut down” or “start up” (which are never ever under any circumstances written as one-word verbs).

    The problem with classifying English correctly is that it is the bastard child of the Germanic and Romance families, springing from the Low German spoken by the Angles, Saxons, and Jutes, mixed with influences of the Romano-Britons, Norman French, Spanish, Celts, Danes…. English doesn’t just “borrow” from other languages, it mugs them.

    For nearly any program, changing the syntax so abruptly would be a horrible thing to do. But I can’t imagine anyone writing commands against Reposurgeon 2.x syntax and wanting to re-use them with 3.x; people who use Reposurgeon generally won’t be able to re-use anything for a future project.

  4. Of course, the reason that programming languages grow VSO (and occasionally VOS) syntaxes in the first place is that English’s imperative format is VO, and many programming languages are imperative to some extent.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">