Furcadia's DragonSpeak (aka "DS": https://cms.furcadia.com/creations/dreammaking/dragonspeak/dragonspeak-reference#parser) was one fun language I've used where something similar was used by advanced coders. Not exactly the same, but the principle of brevity holds, and it shows some possible advantages.
DS lines look like:
# Dance pole crowd responses.
(0:4) When someone turns,
(1:36) and they are male,
(1:29) and they are a Squirrel,
(5:200) emit message {Show us your nuts!} to the triggering furre.
Each line is added with a click in the editor, rather than by writing a keyword, and lines are stacked to create complex if/where/and/or clauses and their effects.
But this can become very verbose to read.
And in fact (as the link above says) you can modify the text of the commands: all that matters to the parser for any line is the numbers, and any strings in {curlies}. So just as in a language where commands are single keywords, the command "WhenSomeoneTurns" might have the abbreviated form "Wst", so in DS, you can abbreviate the command "(0:4) When someone turns," down to just "(0:4)".
So if you have written a block, and now want a large number of similar blocks, you can do something like:
# Dance pole crowd responses to male scuirine dancer.
(0:4) When someone turns,
(1:19) and they are standing at position (68,70)
(1:36) and they are male,
(1:29) and they are a Squirrel,
(5:200) emit message {Show us your nuts!} to the triggering furre.
# Variations (abbreviated versions of the above)
(0:4)(1:19)68,70(1:37)Female(1:29)Squirl(5:200){Show us that tail!}
(0:4)(1:19)68,70(1:38)Unspec(1:29)Squirl(5:200){Work it, squirl!}
(0:4)(1:19)68,70(1:36)Male (1:23)Canine(5:200){Go, hound dawg!}
(0:4)(1:19)68,70(1:37)Female(1:24)Canine(5:200){Shake it, biyatch!}
(0:4)(1:19)68,70(1:38)Unspec(1:23)Canine(5:200){Wag that tail!}
(0:4)(1:19)68,70 Any (1:26)Dragon(5:200){Flame out!}
The variations need only a word or so to call out differences between them and the fully-annotated block.
Because the blocks are now written as oneliners, adjacent and aligned, we can see at a glance how they differ. It's clear even to someone unfamiliar with the language that they all relate to the same coordinate (68,70: likely containing the dance pole), and that this is a list of lines displaying text depending on the gender and species of the pole's dancer.
By allowing this adjacent alignment, the abbreviation makes the code easier to read, and typos easier to spot. The above code has one typo, which you MIGHT have spotted because of this arrangement, but would have been essentially invisible to even experienced DS coders with the code expanded. (Spoiler, reversed: rebmun seiceps s'eninac dnoces ehT)
In code with several thousand lines this can also make a huge difference to sharability. In fact, the first DS code I shared in a forum post, using an early and limited version of DS (http://forums.furcadia.com/200) was 1169 commands, but was reduced down to 334 lines (273 of code, plus whitespace and comments).
Something similar could be done with a language that permits single-character commands. The downside is that variable names would then also have to be short.
It should be immediately obvious that there many MUCH BETTER WAYS to reduce this repetition in any normal programming language. Methods, functions, loops, etc.
Encouraging brevity just so that people can have easily-debugged code repetition feels to me like an antipattern: it encourages the type of repetition I show above, AND it discourages readable-length variable names because they would harm the brevity.
Other than deliberate code golfing, the only exception I can think of where such brevity is useful is the very specific case of a programming language like DS, which deliberately avoids any form of looping to avoid the possibility of shooting oneself in the foot with infinite loops.
G.50
, butLIST
ing the program expanded it toGOTO 50
. $\endgroup$n
, I can just as well typenew
. The same goes forf
/for
,i
/if
, etc. These short keywords are memorized patterns of keystrokes to my brain, and no more effort to type than any single letter/symbol. I think the word, and it appears right in front of my eyes. It is plain amazing how fast you can get at typing oft-repeated words, even when they are much longer. So, I'd say that anyone who feels the need for such abbreviations should consider some touch type training instead. $\endgroup$#define i if
and#define f for
. $\endgroup$