BUILDING WITH BLOCKS; OR WHY GOTO MIGHT NOT BE SO BAD Collin McKinley - 2026-09-03 So this is going to be a bit of a departure from the normal type of essays I tend to upload here. This is more of a musing than something like a well thought out and researched paper. More or less this is a cool idea I had which I want to share with the world and get some feedback. So without further adieu, here is quite possibly the most controversial statement I've ever made in programming languages, I am starting to think "goto" might actually be a good thing. INTRODUCTION AND MOTIVATION =========================== Two years ago, I took the class Software Development with Matthias Felleisen. The biggest thing I took away from that class is that code should be _read_ more than it is written. And at that, code should be _easy_ to read, not just _possible_ to read. What this means is making careful consideration of what a problem is and how it can be solved. Usually splitting complex tasks into smaller, composable pieces with human readable names. Lets say you have a function which does multiple complex tasks. In the interest of making it more readable, you should typically isolate each task and make a so-called "helper" function which only does that sole task. Once this is complete, the helper functions should be composed together to create the complicated task. The ultimate take-away is that the average function should be about 6 lines of code. If done correctly, a programmer should be able to get the idea of the function by only looking at a single screen of text, as at some point, the helper functions will need no investigation thanks to their human readable names. Another thing I've been doing lately is working as a teaching assistant for a class on Computer Systems. In this class, students are expected to write x86 assembly and C to solve various systems-level problems. This class is typically the first (and likely last) time students will see assembly or use it. One thing that has always amazed me though when grading for this class is that the assembly code written by students tends to be orders of magnitude more easy to read than the C code they will submit later in the class. While initially I had chalked it up to the assembly problems being easier (which admittedly they are), I have come to find that assembly might be hiding a really helpful structure which almost all programming languages do not have. A structure which allows you to effectively document _any_ complex task in a very similar way to creating helper functions, all without the actual action of creating those functions, or even thinking about creating those functions. The structure that assembly has which no other language has is the label/goto structure. I have no other way to describe it. In most modern programming languages, there are a multitude of "control-flow structures". These are statements or otherwise which "move" us to another part of the code. Take for example this C statement which decreases the value of x until it hits zero, then once finished prints the message that "X is zero!". while (x > 0) { x = x - 1; } printf("X is zero!\n"); The while loop runs the code contained in the block (enclosed by {}) until the condition is evaluated to false, after that point, it will skip the code in the block and run the next line. Now consider the following code written in a assembly-like language: zero_check: compare x, 0 if-equal-goto print-x-is-zero otherwise-goto decrement-x decrement-x: x = x - 1 goto zero_check print-x-is-zero: print "X is zero!" In assembly, text which is followed by a ":" is known as a "label", and it marks a position in our code which we can "jump" to, or start executing code at. While this example is in a totally fictitious assembly language, it is not unlike many modern assembly languages currently in use. The interesting thing here when compared to C is tasks are named. In our original C code, the task of checking if x is zero is still performed, however it requires the programmer to understand the code "while (x > 0) { ... }" to understand what the task is doing. While this is not exactly difficult to do (and most programmers should hopefully be familiar with a while loop from any number of languages), it still provides a barrier to communication. In assembly, there is no abstraction over control flow, therefore all individual tasks need to be given explicit names so we can jump to them when need arises. The reason that it felt easier to read student written assembly rather than student written C was very much a result of this explicit naming. As tasks got more complex, intentions would typically get lost in the sea of nested while and for loops. At this point, it was no longer enough to look at the code and get a rough idea of what the core idea was, it was now necessary to fully read and interrogate the code, effectively simulating the runtime of it in your head. While some of this would probably be mitigated by using more helper functions (and trust me, it totally would go a long way for some students' code), there will always be cases in C where being dropped in a random line of code will require some reading of context (sometimes hundreds of lines of context) to figure out exactly what that line is supposed to be doing. THE PROGRAMMING LANGUAGE ITSELF =============================== There is no language yet. I am still trying to figure out how best to implement or realize this project. However at the moment I do have it working as a macro within Racket and can already see its benefits. It doesn't have a name at the moment, I tend to call it "Elehtra", which is the name I use for any of my unnamed programming languages (the Old English word for the plant lupine, pronounced like "electra"). At the moment it has the following syntax: (define/elh ( ...) (( ) ...) [