The Philosophy of Copy and Paste

I have a new paper out with Tomas Petricek: Interaction vs. Abstraction: Managed Copy and Paste, to appear at PAINT’22. [Demo video] I have mixed feelings about this work.

I’ve been talking about the idea ever since my first Subtext paper, and tried to build it several times, but hit many difficulties. This new theory of structure editing I’ve been working on seemed to make it possible. So I had to try it.

The idea is philosophically tantalizing. There is a long-running intellectual debate between those who believe in Logic and Formal Methods as an account of language/cognition/programming and those who reject those accounts as shallow and inadequate. Wittgenstein famously took both sides. I believe programming offers us for the first time a way to substantiate the anti-logic position with a constructive theory that is more than just counter-examples and anecdotes. Managed Copy and Paste is my primary candidate for an Informal Method that takes on the Formal Methods.

Functional abstraction is considered to be the essence of programming languages, enshrined in the holy Lambda Calculus. A key benefit of functions is to centralize change. But if we can track copies and propagate changes between them then having a centralized abstraction is more of an ideal end-state than a necessary condition. The key change of perspective is to move from a program as a static crystalline abstraction to programming as an interactive process of continual adaptation. Managed Copy and Paste subverts functional abstraction and could actually be more ergonomic in practice.

The good news is that it works, and my editing theory handles tricky cases like copying copies. Unfortunately I’m not sure it turns out to actually be more ergonomic. At the very least it needs a lot more UI work. At the moment I’m afraid it is isn’t a slam dunk win, and it needs to be a slam dunk to get anyone to seriously consider such a radical change. Bottom line, I love the idea and its philosophical implications, but in practice it may be more of a luxury than a must-have. A vitamin, not a pain killer.

But what do I know? Tomas convinced me to write this paper to at least put the idea out there and see what happens. What do you think?

8 Replies to “The Philosophy of Copy and Paste”

  1. I love this idea. What if we took a wrong turn with functions? Hyper-in-lining. I wonder if it could be taken further and all static pointers could be inlined.
    How much of the UI complexities arise from the use of a traditional language? Could a new DSL help?

    1. I found a spare minute to try and explain this better,

      The walkthrough in the paper is really useful. I can see how complicated it gets resolving changes down to the individual token in the AST, even for one copied statement. In a way the walkthrough is disappointing – we started reading about whole functions but ended up manipulating values in a single statement.

      A dumber approach would be to keep each copied region of code as identical clones of each other. Imagine you have copied a stanza of related statements and insert a new line of code between them – if the copied stanza is tracked as a whole (like a function body), the new line of code could be inserted into the original as well.

      The walkthrough starts by copying the original statement and changing the name of the assigned variable (“avia”) – with this cloning approach the user could:

      Highlight the text beginning with the equals sign until the end of the statement
      On a newline type “aria ” and then paste the rest which is recorded as a copied region.
      Thereafter any changes to the copied region are reflected in the original region (which follows “rail “).

      This approach wouldn’t support changing the predicate value in one expression within the copied region but not the other, but then again functions don’t support that either. One weakness is that the copied regions themselves may not be valid syntax when pasted away from their original location …

      1. Hi David,
        Thanks for your comments. Restricting copies to clones could be a good way to simplify things, and maybe that is more of a sweet spot. In this paper I wanted to explore more general relationships to see how far I could get. One idea I didn’t get worked out was to treat function calls as copies. A call would be essentially inlining the function body and editing the arguments into the parameter definitions. Then you could also have “semi-calls” where you not only modify the parameters but also hack in some changes to the body of the function. I’ve wanted that so many times – a function does almost what you want, but it would be premature to refactor it. But I couldn’t get this idea worked out before I ran out of time to write the paper.

  2. I see a different duality here: if the primary form of information systems is text or “something else”.

    The “record” in Memex from Vannevar Bush was not around text and even JCR Licklider chose a text-oriented approach in the Libraries of the Future to prove that the exponential growth of IT systems capacity will allow handling (the transferrable part!!!) of the human knowledge by estimating its character count – proving that Memex services are achievable and worth the effort.

    The ultimate example is that even all followers of Douglas Engelbart think that NLS was a text editor, missing this key statement:

    “For explanation purposes here, let’s say that the lowest level at which the computer system comes into direct play in my capability hierarchy is in the task of what I’ll call ‘single-frame composition.’ We’ll stick to working with prose text in our examples—most people can grasp easily enough what we are doing there without having to have special backgrounds in mathematics or science as they would to gain equal comprehension for some of the similar sorts of things we do with diagrams and mathematical equations. This low-level composition task is just what you normally do with a pen or pencil or typewriter on a piece of paper—that is, assemble a bunch of symbols before your eyes in order to portray something which you have in mind.”

    He noted that text editing is the lowest level, emulating pen and pencil with a computer, but the easiest to explain. Therefore it stuck forever…

    Or the other story when Neil Postman, a most literate person in all meanings, tried to explain Alan Kay and developers at Apple that computers could make ours the last generation that used text. Unfortunately the audience did not think that they should have listened.

    So, the problems you list here arise from using a fundamentally output form: serialized text for dynamic interaction with knowledge. You can’t solve it by text-oriented tools.

    If you leave them, you can see that the duality you mentioned is the same as the difference between state machines (and therefore, the usable Chomsky language classes) and the Turing Machines (where the DSL does not describe the system but the algorithms to execute on it).
    That leads to the consequence that they both are necessary for a dynamic information systems modelling, similar to Tensegrity that allows moving from arch bridges (text-oriented IT) to suspension bridges (adaptive systems that “learn” at runtime).
    And that opens the path to general aims: movable (Engelbart “C”) and self-improving systems (AGI). For the record: the definition of an AGI is that it has no source code that is not generated by itself. Self generation is not a big thing, the “all” part is that turns everything upside down (I’m struggling there at the moment).

    Sorry, TMI and you don’t seem to care about what I say, but the questions were legit. Peace.

    1. Thanks for your comment. That Engelbart quote is a good find. I believe that text is holding us back, but it is really hard to replace! I’m still just scratching the surface of what it will take. All the new ML programming tools that everyone is so excited about are text-based. Text is stronger than ever.

  3. Jonathan,
    As I imagine you traveling to New Zealand, I wish to say:
    “in bocca al lupo!” …
    which is Italian for “break a leg!” 🙂
    I owe you some comments and updates, but mainly gratitude.
    Thank you for your insights and encouragement over the years.

  4. Cut & Paste now has a new source : ChatGPT !
    This is a new form of perversion because the service seems so to know everything and answers almost all questions. It pretends to be able to convert any code snippet from a language to another (even ASM!).
    So this is the ultime cut and paste. Before the copying was clueless, but now the original author of the code is also a numerical mess without any clue of what it is doing.
    And the disease does not target only programming anymore but any intellectual production, like poetry, fiction and mathematical proofs.

Comments are closed.