Domanda

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?

È stato utile?

Soluzione

Real world apps, eh?

The game Lost Kingdom won the First Annual Classic 2k Text Adventure Competition in 2004, and has been (re)written and enhanced by the original author in brainfuck

How about an IRC bot in Befunge or this text editor? And I suppose if you like writing in esoteric languages, you might consider a befunge to C compiler or a brainfuck to C compiler very useful...

Altri suggerimenti

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:

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.

job security!!!

If there is a practical use to a language it wouldn't be called esoteric. The two terms are mutually exclusive.

Understanding Turing machine, Computability and having a practical sense of what is implied by the theory of computation. All the practical benefits can be gathered if you use an esoteric language like brain****.

I am sure, there are others too.

Some classes of esoteric programming languages have applications in theoretical computer science.

Turing tarpits have uses for illustrating certain results in computability theory and the halting problem. See for example the work of Ianov (there's a slightly more accessible summary partway down this article).

Fundamental results for classes of Turing machines are another practical application. For example, Wikipedia notes that P'' was "the first 'GOTO-less' imperative structured programming language to be proven Turing-complete."

Binary combinatory logic is a useful tool for analysing Kolmogorov complexity.

Inspired by this question, and its answer, I too have found a practical use for such a language: GolfScript, a language designed specifically for code golf:

GolfScript is a stack oriented esoteric programming language aimed at solving problems (holes) in as few keystrokes as possible. It also aims to be simple and easy to write.

There you have it, straight from the people who wrote it. Although it might be debatable whether or not code golf is a practical matter, my personal belief is that it gets as close as it gets to something you and I might actually write and encounter, not to mention it's a fun programming exercise, and a competition with a lot of fans. So... if gaming, football, and all kinds of other entertaining activities are in a way or another... practical... I'm feeling free to include code golf too :)

The only practical benefit that I see, is that if you wrote code in an esoteric language, it would cause you to think about problems in new and interesting ways. Learning new ways to approach problems will benefit even when you are back programming in a mainstream language.

Last year I read Charles Petzold's 'Annotated Turing'. I certainly have no intention to ever program a Turing machine, at least as he describes it. But thinking about solving problems with his 'language' stretched my mind. I'm a better C# programmer for it.

Sure; Fungot, the IRC bot: http://zem.fi/~fis/fungot.b98.txt

Developing of esoteric language is like creating Mandala. After endings of work you can forget it or even destroy.

If you judge only by the Wikipedia link:

An esoteric programming language (sometimes shortened to esolang) is a programming language designed as a test of the boundaries of computer programming language design, as a proof of concept, or as a joke. There is usually no intention of the language being adopted for real-world programming.

then, no, there is no practical application of such a language to a real problem.

The reasons aren't insults to the languages, they focus on "practical":

  1. In practice, if you're solving a problem, you need to be able to convince yourself that you've solved it. If you're using a language that is specifically designed to be hard to read, it's going to be hard to visually inspect your solution and say "Yes, this is correct."
  2. In practice, you're not working in a vacuum. In real life, you're always working with a non-zero set of other people (even if it's just you-in-the-future). Someone else is going to have to maintain your solution, adding a feature here, fixing a problem there or, worse, trying to document what you did and why.
  3. If neither 1 nor 2 apply, you have created a solution to a problem that is (a) trivially easy to inspect and (b) never requires maintenance because it is never used in practice. It is, therefore, a trivial / non-practical problem.

colorforth is very powerful, and it practical.

OKAD and GA4 in 290K

Code obfuscation is a very common practical use :-p

And I don't know if the APL/J/K family could be called esoteric, but they've been used in production systems from a long time.

There exists a language called Pilot. It is a interpretive language written in Dartmouth BASIC (an interpetive language). It's initial use was for non-programming teachers to be able to program their tests. All commands in the language are single letters and the letter used defines what options are available. It is ancient, (I learned it in 1976) and as far as I can tell, no longer has any use.

Among other uses, the more minimal could be used as (black boxes)/(sandboxed algorithm languages) for algorithmic searches, for search uses such as constraint based programming and evolving solutions.

This answer addresses 3 types of esoteric programming languages:

  • Golfing languages
  • Turing tarpits
  • Languages in games

Golfing languages are useful when you need to hack something together for a one-time use. Rather than script a 100-line Python program or go through a debugging spree because you made an error on something that's a builtin in a golfing language, just connect a few builtins and get the job done quicker.

Turing tarpits are useful for creativity. You have to think outside of the box with the few commands the Turing tarpits have. In BF how would you go about converting the integers given to you via the program (which are just a bunch of ASCII values) to something that you could handle (like a single cell value)? How would you check for equality? How would you add two numbers?

Turing tarpits are also useful for practicing code organization. When a simple task such as adding two numbers takes you to make psuedo code and have a layout of the entire program, you have to organize your program. In BF to add two cell values, you would need to: 1. Decrement the first addend 2. Increment the second addend 3. Loop until first addend is empty.

Languages in games are useful for enhancing the experience in worlds/levels for players of that world/level. In Roblox (although I wouldn't call it's scripting language "esoteric"), if you just put in some parts and models in your world, would it be fun? No. If you scripted those models to fight you and equip yourself with a gun? Maybe. In Geometry Dash you could make the level harder by requiring you to click a certain amount of times in it's "programming language", or make it use pseudo random attacks in a boss fight. Esoteric programming languages in games can greatly enhance the realm of possibilities in a level/world.

Eiffel, Erlang, Ocaml, Haskell. These are all "niche" languages for most of the programmers out there, yet they are practical inside their domains. Your question simply doesn't make sense, it might be well asking "Are there any good languages that we don't use in popular problem domains?"

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top