Title text: The worst is when you run out of monospaced fonts and have to use variable-width variables.
Cueball has developed a new programming language with novel syntax. Such languages are usually classified as esoteric languages — programming languages developed for no practical use other than novelty, challenge, or academic interest, and which are difficult to understand or work with (although that doesn't stop people from trying to use them). Some classic examples of these are INTERCAL and brainfuck.
Normally, there is no law against developing bad programming languages or bad code (although some would argue there should be). The law often has to play catch-up with technology. However, as when the EPA took an interest in Cueball's Laptop Issues, and Cueball's other tech support problems, it seems that a judge has previously ordered Cueball to stop developing new programming languages, possibly because the result was so egregious as to cause real harm. However, the ruling was overturned on appeal, and Cueball is free to inflict his work on the world once again, unless and until there is another appeal. Cueball's use of the phrase "higher court" suggests that he has not gotten a ruling from the Supreme Court of the United States or whatever state has jurisdiction over him, or else he would have said so, and evidently the offscreen voices hope to appeal to them and get Cueball's injunction reinstated.
A variable is a piece of data (such as an integer or a string of text) whose value can change over the run of a program. Variables are identified by name and can usually be named any string of alphanumeric characters. To make code easier for a human to follow, variables are usually given a name that indicates what the variable is for; for example, a variable counting how many seconds have passed since the program was launched might be called elapsedTime.
The overall concept of a variable is usually first taught in Algebra, where the most basic nondescript name for a variable is x. When first learning or teaching programming, it's not unheard of for sample variables in practice problems to be named "x". However, outside of a controlled learning environment calling any variable "x" is considered bad coding practice, because anyone reading the code will not immediately understand what the variable does unless they are familiar with it. Even the original programmer may come back to it and find that they have forgotten what the variable was for.
Here, Cueball is developing a language where all variables are named X - and the only way to differentiate different Xs is to write it in different typefaces. Needless to say, this is a terrible idea. The language would be a nightmare to program in, as all of the variables would look very similar unless careful attention is being paid, and there would be little to no way to determine what each one does, since font names are typically not very descriptive. Additionally, the fact that some fonts look similar (such as Arial and Helvetica) would require the programmer to have an intricate knowledge of different fonts and how to distinguish them from only one letter.
Such a language would also require the source code files to be in some rich text format such as a Word document, in order to store the font information. Additionally, it would also require the use of a word processor or similar in order to edit the code. Programs would also run into difficulties if the system does not have the required fonts installed, or if the font is not licensed for them to use.
By contrast, normal code is always written in plain text (usually with ASCII or UTF-8 encoding), which does not specify a typeface and can be edited by even the most basic of text editors.
This comic may also be a jab at mathematicians, who by convention use variable names which are short and nondescript (e.g. "x"), and which can also be "typeface sensitive" - for example, ℕ denotes the set of natural numbers, and it is not uncommon to see the definition of a limit as "For every ℇ>0 there exists N in ℕ such that for every n in ℕ, if n>N, |f(n)-l|<ℇ". Or for example, ℜ may denote the real part of a complex number, whereas ℝ denotes the set of real numbers, and R might denote the radius of some circle in the complex plane.
The title text references the fact that most code editors use a monospaced font (i.e., one where every character is the same width), as opposed to variable-width fonts, in which some characters like 'I' are narrower than others. This is partly because fixed horizontal alignment is sometimes useful when dealing with certain text strings.
'Variable-width variables', a pun on two meanings of the word 'variable', refers to the fact that the letter X, like all letters, has different widths in different fonts. This would make this fixed alignment almost impossible, thus creating yet another reason why Cueball's language would be highly unpleasant to use. It likely also directly (mis)refers to systems such as variable-width encoding in which the data linked to in a variable storage is packed into an unfixed number of bits and/or bytes. Such systems often use Huffman-type encoding to progressively differentiate, from the initial elements, how many more elements are needed to fully define the value, but a reserved deliminating value marking the end of a cumulative arbitrary-length array might be considered another form.
- [Cueball holds a laptop with code visible on the screen.]
- Cueball: I've developed a new programming language!
- Offpanel voice: Didn't a judge order you to stop doing that?
- [In a frameless panel, Cueball holds the laptop with one hand and types on the keyboard.]
- Cueball: Higher court threw out the ruling!
- Cueball: I'm back, suckers!
- Offpanel voice: Dammit.
- [Cueball holds the folded down laptop at his side.]
- Cueball: But I promise it's good this time!
- Cueball: Just normal code. Good clean syntax. Nothing weird.
- Offpanel voice: Okay...
- [Cueball holds the laptop at his side, and raises a finger on his other hand.]
- Cueball: Except the only variable name is "X". To refer to different variables you have to write "X" in different fonts.
- Offpanel voice: I'm calling the court.
- Another offpanel voice: Maybe we can appeal.
- See this page for a more detailed explanation for this language.
add a comment! ⋅ add a topic (use sparingly)! ⋅ refresh comments!
id certainly use that language lol (126.96.36.199)
-- haXkell is a X-based dialect of haskell
X :: Integer -> Integer
X 0 = 1
X X = X * X (X-1)
Capncanuck (talk) 02:35, 21 May 2020 (UTC)
https://esolangs.org/wiki/X isn't taken. --Blacksilver (talk) 02:40, 21 May 2020 (UTC)
- It has been taken as expexted. 188.8.131.52 05:24, 18 June 2022 (UTC)
Some unique looking variable names would be X and x in the fonts Webdings, Wingdings, Wingdings 2, and Wingdings 3.
They are respectively as follows:
X x X x X x X x --Dstrube (talk) 02:49, 21 May 2020 (UTC)
- This comment is quite uninformative to someone who doesn't have those fonts installed. Angel (talk) 09:57, 21 May 2020 (UTC)
As well as esolangs, among which I would consider the likes of Whitespace and b****fuck as potential inspirations, I think I'm also minded of TempleOS and its creator as vaguer but possibly still related influences... 184.108.40.206 03:28, 21 May 2020 (UTC)
- I find it ironic that you censored the word "brain" but left in the word "fuck".
- ProphetZarquon (talk) 16:09, 21 May 2020 (UTC)
I added an explanation of what a variable is and why it's bad to have every one named X. It's pretty rudimentary though, hope someone more experienced than me will improve it. Goodbye, world! (talk) 04:39, 21 May 2020 (UTC)
- Forth basically doesn't use variable names. Commands operate on and consume the last number mentioned. A Forth program "1 2 3 . . ." prints 3, then 2, then 1. "2 3 + ." prints 5 I think??
- In Microsoft "Transact-SQL" you can script variables named starting @ and temporary objects starting #. I promise I try to resist naming objects @ or # and especially if @ or # is going to be a different object in each program... or is not. And if someone else needs to reads this (and I don't want to punish them). Not to mention "@ " for instance. Robert Carnegie [email protected] 220.127.116.11 09:21, 21 May 2020 (UTC)
Psh you're all chicken. Chicken chicken chicken.
[Language where you can have return keyword in a if condition], [Language that uses unicode symbols for built_in operators], [Language, I have no words to describe], and this this X thing is winning so far... 18.104.22.168 06:35, 21 May 2020 (UTC)
- Yeah, but C++ does that shit either unintentionally or at user demand (although, to be clear, I'm not saying it's any good; C++ and Java are possibly the worst programming languages in terms of shoddy design). The X programming language is just the designer being an asshole. 22.214.171.124 07:04, 21 May 2020 (UTC)
- Those links have nothing to do with C++/Java and you can Not do those things in C++ or Java (except an if in an assignment).126.96.36.199 08:02, 21 May 2020 (UTC)
- Those look like pretty sane language features; just looks weird because of the Eliza effect; those keywords don't behave like you'd expect them to based on experience of other languages. In the first example, you can certainly do that in Perl using "if (defined wantarray)"; it's just unusual (but comprehensible) to name the keyword "return". What language is that? Angel (talk) 09:57, 21 May 2020 (UTC)
- Language is called ShapedLikeItSelf, but it currently has no runner. Documentation is just of images like these on discord server.
- [This is link to it] if you are intersted. 188.8.131.52 10:19, 21 May 2020 (UTC)
Did Randall refer to this comic? https://xkcd.com/1537/ I vaguely remember another one about an esoteric language. Is there a category of programming languages on explainxkcd?
Am I the only one that tried fiddling the CSS on the page to see if the X would change? Spoiler -> It didn't. Xseo (talk) 08:54, 21 May 2020 (UTC)
If X is the only variable name, can it be omitted? For example, writing a single-argument function name in a different font to imply which X should be treated as its argument. And that gets me wondering how the source is stored; will the IDE allow use of fonts not installed on your system? Will the compiler fail if it can't find the font, requiring you to track down all of the fonts a developer used in order to compile their code? And what would be the legality of mixing open-source code and proprietary fonts? Angel (talk) 09:57, 21 May 2020 (UTC)
"… and array indices start at 8, because anything smaller than that would be unreadable." Angel (talk) 10:00, 21 May 2020 (UTC)
Who is going to implement this first??184.108.40.206 13:03, 21 May 2020 (UTC)
Hey guys what coding language did he do to almost be arrested? 220.127.116.11 14:18, 21 May 2020 (UTC)Anonymous
- Well, I've got this one with just four operands, everything's a relative address in 4-cored circular memory and there's no paractical differentiation between the packed opcodes, addresses and data (or their 2-bit lower-limit boundaries) when operated upon from elsewhere. Everything suggests it should be be Turing-complete. 18.104.22.168 11:47, 22 May 2020 (UTC)
Isn't the fixed vs variable width a pun on the variable's internal size, eg. a 64-bit integer [fixed width) vs a string (variable width) ?
I sure hope this new language at least supports indexed tuples. If so, that wouldn't be so bad, unless for some reason I needed more than one tuple in the same scope.Whiteheadw (talk) 23:01, 21 May 2020 (UTC)
Harrumph. I'm sticking with LOLcode http://www.lolcode.org/ and thats an end of it. Cellocgw (talk) 14:03, 22 May 2020 (UTC)
Is this a continuation of the Code Quality series? TomW1605 (talk) 14:05, 22 May 2020 (UTC)
I'm not sure that this: "ℝ denotes the set of natural numbers, and is distinct from R" is strictly true. The way I was taught is that boldfaced R does stand for the real numbers, except when it doesn't, and blackboard-bold ℝ (and Q, and C, and Z) are just what you write on the blackboard since it's impossible to make a clear boldfaced R with chalk. Not that the main point doesn't stand--too many circumstances where plain P, bold P, italic P, and fancy curly script P all mean different things. 22.214.171.124 18:57, 22 May 2020 (UTC)
- Blackboard Bold isn't a reliable convention but, generally, N is the set of naturals, R reals. https://en.m.wikipedia.org/wiki/Blackboard_bold 126.96.36.199 20:32, 22 May 2020 (UTC)
And to continue on the "jab at mathematicians" line of thought... Either the recently mentioned P's or an "a vs alpha" (a in the Symbol font) or something similar might make better examples than that N in #Explanation... -- 188.8.131.52 16:41, 23 May 2020 (UTC)
This comic was tweeted by Guido van Rossum (creator of Python), and apparently this is legal Python since PEP 3131! Divieira (talk) 19:53, 26 May 2020 (UTC)
This is the only comic I have Noticed where the title is shorter than the number, Also You cold have upper and lower case X.
Gunterkoenigsmann (talk) 07:57, 09 Jun 2021 (UTC)
- If you scroll through the archive you'll find plenty of 3-letter titles, many of these belonging to 4-digit comics. --Lupo (talk) 13:03, 10 June 2021 (UTC)