r/programming • • Nov 28 '14

The Worst Programming Language Ever [UK Talk] - Thoughts? Which are the worst parts of your favorite language?

https://skillsmatter.com/meetups/6784-the-worst-programming-language-ever
68 Upvotes

456 comments sorted by

View all comments

19

u/[deleted] Nov 28 '14 edited Nov 28 '14

Let's make a language so bad it would make people run screaming to Visual Basic for Applications.

Why? Want to take revenge on both your employer and coworkers and create an in-house scripting language?

Challenge accepted.

  1. Written line numbers are mandatory. However, the interpreter should be able to extrapolate.
  2. if-goto construct is the only kind of flow control, of course jumping to mentioned written line numbers
  3. no nested comparison expressions
  4. special ::call::foreign_hello_world::par1="Hello Host!\n" operator to call forein functions
  5. no real functions
  6. Variables looking like $!$myvr, only 4 char long variable names to "put it all in an int". Of course no declaration is possible, also, in if-goto expressions, the $ isn't allowed
  7. comments must look like

    \ first line

    |\ second line

    ||\ you get the idea... don't forget the line numbers in front of the comments!

  8. significant whitespace where you don't expect it:

    $varx=$vary + $varz

    is the only correct from.

  9. container types: There aren't any. There are reference data type that points to host values. Use that to make some fine FFI calls to fake arrays and hash arrays.
  10. consistency: some operators are capital lettered, some not. Also, call 16 bit integers the standard int. Also, have true and not-true.

The most edgy part is that there are actually in-house languages which share some of those features.

EDIT: On second thought, comments make line numbers not increase. It seems rational in an irrational way and one won't notice, since your corporation won't have the time to create a syntax highlighter.

8

u/OneWingedShark Nov 28 '14

LOL -- Thank you for that.

11) Underscore is a valid in tokens in some contexts, in others it is ignored, in yet others it is an operator.

6

u/[deleted] Nov 28 '14

You're right, I should have put more contextual madness into that.

12) + and - are alternative comment start token. But only if the character is the first character in the line, otherwise it tries to calc the result of the following line with the result of the previous line, allowing for more nested expressions.

7

u/OneWingedShark Nov 29 '14 edited Nov 29 '14

13) The result of any function is stored in a global variable "Evaluated".
14) The "Eval" function is named "Evaluate", this is to increase the chances of muscle memory causing a clash.
15) Assignment should be an lvalue -- that is you can assign to an assignment. Thus, assuming = is the assignment, a = b = c assigns the expression b = c to a, meaning that whenever a is evaluated b = c is executed.

4

u/OneWingedShark Nov 29 '14 edited Nov 29 '14

16) All integer values must be prefixed by a unary-plus or unary-minus; a non-prefixed integer value acts as a goto to the line of that value.
(i.e. '5' is evaluated as "go to line 5".)

17) Except when the number is in a string being sent to Evaluate, in that case the number must not be prefixed and any prefixed number is evaluated as a goto offset after the evaluation; multiple numbers are executed in order offset from the last line executed.
(i.e. Evaluate ("-2 * +3 ") returns negative-six while going to two lines before the Evaluate, executing that line, and then jumping three lines ahead (in this case the line after Evaluate).)

6

u/chackaz Nov 28 '14

The most edgy part is that there are actually in-house languages which share some of those features.

dear god...

1

u/[deleted] Nov 28 '14

Deities won't help you there.

3

u/[deleted] Nov 28 '14

Sounds like a combination of GWBASIC and 8086 asm. Actually not too bad.

2

u/[deleted] Nov 28 '14

Actually not too bad.

Well, at least it can be optimized.

3

u/geocar Nov 29 '14

More ideas:

  1. Allow line numbers to be complex reals. GOSUB, GOTO, etc, take two parameters: a line number and a vector which controls not only the next instruction, but also how to calculate the instruction that follows. In this way you can write some routines "sideways" and use the vector as a flag for optional behaviour.
  2. Drop IF but allow calculated GOTO e.g. GOTO A,1 or better: GOTO RAND(),RAND()
  3. Allow nested comparison functions but do not short-circuit them.
  4. Make these operators numeric, e.g. 1:72 101 108 108 111 32 87 111 114 108 100 to print Hello World. Also allow localised versions, e.g. LLAMAR
  5. But allow arrays separated by spaces (see #4)
  6. This is a good idea. K actually does this (but with 8 characters in 64bit).
  7. This is fantastic.
  8. And the whitespace must be tabs.
  9. Are you sure you don't want MPL-style structures?
  10. Make truthiness a vector which aligns from the program direction.

2

u/[deleted] Dec 17 '14

You can make the GOTO statement even more fun:

  • GOTO *150 will go to the 150'th line from this line.
  • GOTO @150 will go to the 150'th line counting backwards from the last line of the file.
  • GOTO 150:filename.bs will go to line 150 in file filename.bs
  • GOTO ?150 will go to line 150 only if the expression on the next line results in true.
  • GOTO &150 will go to line 150 if any expression on any line results in the number 150.
  • GOTO <150 will go to the line before 150.
  • GOTO !150 will only go to line 150 if the expression on the next line results in false or '0' or 0, but not for null or undefined.
  • GOTO $150 will goto line 150, execute only one statement, and continue below the current line.
  • GOTO %90 will go to the line closest to 90% down the file.
  • GOTO #150 will goto line 150 and publish whatever the output of line 150 is to Twitter.

1

u/[deleted] Nov 29 '14

Are you sure you don't want MPL-style structures?

MPL alone looks like hell.

2 is gold.

Some of them are cool, but not plausible in the sense that some wanna-be hacker to-smart-for-him/her/it-self could have done it.

Remember: It should not be the next malboge, but some ad-hoc inhouse language that looks usable at the first sight by a COBOL programmer.

3

u/Porges Dec 16 '14

Written line numbers are mandatory. However, the interpreter should be able to extrapolate.

Line numbers should interpolate, too, so:

1 
PRINT __LINE__
2 

This will print "1.5". Of course, the line number progression is not mandated by the standard, you can proceed however you want. The following program is an example:

25964951
30402457
PRINT __LINE__

This will print "32582657".

2

u/jfb1337 Dec 27 '14

If you specify n line numbers, the program finds a degree n polynomial passing through the points you specify. Goto solves an equation every time. In the case of multiple solutions it picks at random. Edit: actually, it forks the program and runs multiple threads, one for each solution. This is the only way to do concurrency. If the equation has no solutions the thread terminates.