esolang

Verbosity

"A practical programming language designed to lose code golf competitions." Hello, World! takes 444 bytes.

caird coinheringaahing · Turing complete: unknown · ●●○ moderate

Tested with 3 known programs · Hello World on Try It Online: identical except the line end · Test method

Run it

Expected: Hello, World!

The idea

Code golf rewards the shortest program, so caird coinheringaahing made a language where nothing is short. Every type has to be included before it is used, every variable name needs at least 10 characters, and the program only runs because its main block asks to execute the script file.

Read the story

Its author later archived it and wrote Verbosity v2, calling that one much better. This implementation follows the first interpreter, which Try It Online still runs, bugs and all.

The machine

A line is Name<argument; argument>. The interpreter turns each line into the text of a Python list and evaluates it, so only tokens of letters, digits, @ and :, or strings in double quotes survive. A minus sign or a decimal point vanishes.

LineDoes
Include<String>Allows the type: Integer, String, Output, Input, Boolean, MetaFunctions, ...
Integer:DefineVariable<IntegerOne; 1>A new variable of that type
String:RedefineVariable<Name; String:Method<a; b>>Gives it a method's result
Output:DisplayAsText<STDOUTfile; Name>Prints a variable and a newline
Name:Increment<>Calls a method on a variable, changing its value
Loop:WhileCondition<Name>[ ... ]A loop, once Structure<Loop> is included
DefineMain<> [ MetaFunctions:ExecuteScript<MetaFunctions@FILE> ]Runs the rest of the file

The surprises come from the Python underneath. A string keeps its quotes, so the Hello World cuts off one character from each end. TakeFirstCharacters<s; n> drops n characters from the end, and RemoveCharactersFromEnd keeps the first n. An Integer prints as Integer<3>. The arithmetic methods Sum, Product and the rest always fail, because they call a type check with too few arguments, so only Increment and Decrement change a number. Any error ends the program, and so does the next line after more than 127 characters have been printed.

Example

The last program reads a line and drops its last two characters.
Expected: Integer<3> Integer<4>
Expected: Hello the

The last program reads a line and drops its last two characters. ReadLineFromInput is called on the Input type, so it needs some variable to stand in as self; any will do.

Patterns it teaches

  • Hostile design: long names, compulsory boilerplate, and methods whose names say the opposite of what they do.

Try this

  1. Print Hi from a string in quotes.
  2. Count down from 5 with a loop.
  3. Hard: print the second word of a line of input.

Further

Also in Jokes

Write your own in Run Convert a program from Verbosity

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: verbosity.

Command line

shib run verbosity program.txt

The program is long; save it as program.txt first.

shib manual verbosity

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/verbosity.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language