Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any practical use for an esoteric language?

Tags:

Do you know any example of an esoteric language used to write any practical-use, real-world program? Is there any, however obscure, domain of computer science where an esoteric language has actually been proven useful for solving a specific problem?

like image 264
luvieere Avatar asked Oct 02 '09 09:10

luvieere


2 Answers

There is no practical use for an esoteric programming language, pretty much by definition. However, just because you cannot use them, doesn't mean they aren't useful.

tl;dr:

  • Non-deterministic esolangs highlight the non-determinancy of all thread-based programming
  • Turing tarpits highlight how no programming language is more powerful than any other (if both are Turing-complete), thereby distinguishing "computational power" from "expressive power."
  • They force lateral thinking and are brain-teasers

For example, when you look at esoteric programming languages, you can roughly divide them into categories: some are created as a joke, some are created just for fun, some are created as Turing tarpits, but there are also some that are created to prove or illustrate a point. And these are actually useful for exactly that: illustrating a point, maybe in a programming languages class, maybe to the community or to the industry. Even though they are useless for practical purposes, they are useful for educational purposes.

Take non-deterministic esoteric programming languages. These are programming languages for which the evaluation semantics of certain expressions are not defined deterministically, but for example probabilistically or based on the phase of the moon or something like that. If you look at the definition of such a language, you will immediately think: "Well, that's just stupid." And it is! (For example, the Hello World program in Java2k is almost a page of code, and it isn't even guaranteed to print "Hello World" every time, only most of the time.) And yet, most of today's mainstream programming languages have non-deterministic concurrency models. IOW: as soon as you start a thread in Java, C#, Python, Ruby, Perl, even Erlang or Clojure, your program becomes just as random as in the esoteric language Java2k. So, why do we think one is stupid and accept the other as normal, even though they are essentially the same thing? By taking non-determinism to the extreme, and packaging it up in a fun way, esolangs allow us to ask that question.

Another example is Turing tarpits. A Turing tarpit is an esolang which has almost no features but is still Turing-complete. Such a Turing tarpit can be used to demonstrate two different things: you can use it to demonstrate what exactly it is that makes some languages more "powerful" (in the sense of expressive power) than others. If you search around on the web, you will find people ask "if Lisp is so much better than Java, why don't you show me some program that you can write in Lisp but I cannot write in Java." And, of course, that's stupid: both languages are Turing-complete, so there is no such program. However, by contrasting Java with, say, Brainfuck, you can show that this is just not meaningful question to ask.

And the other thing you can demonstrate with Turing tarpits is that you can never make a language more powerful (in both senses of the word: computational power and expressive power) by removing features. It sounds obvious, but there are people who actually believe that Microsoft should just remove mutable state from C#, and it would magically become more powerful.

In general, Turing tarpits are good for demonstrating the distinction between the computational power and the expressive power of a programming language.

Other ways in which esolangs can be useful is that they can serve as an inspiration for programming language research. Think of Unlambda, which, as the name implies, is a functional language which is not based on the lambda calculus. In other words: it's a functional language which doesn't have functions.

And last but not least, esolangs can force you to look at a problem from a completely different angle (yes, I admit, it's mostly an awkward angle, but hey, some movie directors (Hitchcock, for example) owe their whole career to looking at things from awkward angles) and they tease your brain like a good puzzle. That is, for example, the whole reason for the existence and the name of Brainfuck.

like image 190
Jörg W Mittag Avatar answered Sep 22 '22 16:09

Jörg W Mittag


job security!!!

like image 33
wefwfwefwe Avatar answered Sep 24 '22 16:09

wefwfwefwe