2 ms·
I appreciate Brainfuck for its originality, but I agree with the grandparent that its influence on "esoteric languages" is too strong. Not only are many "esoter
by chriswarbo 12y ago
I appreciate Brainfuck for its originality, but I agree with the grandparent that its influence on "esoteric languages" is too strong. Not only are many "esoteric languages" just Brainfuck+something (eg. http://esolangs.org/wiki/Category:Brainfuck_derivatives http://esolangs.org/wiki/Category:Brainfuck_derivatives ), but also having Brainfuck as the default "minimalist language" is also unfortunate. For example, a NASA study on self-replicating machines ( http://www.niac.usra.edu/files/studies/final_report/883Toth-Fejel.pdf http://www.niac.usra.edu/files/studies/final_report/883Toth-... ) mentions it on page 43:
> ...we thought that our Controller subsystem should also be as simple as possible. We spent quite a bit of time looking at the simplest implementation of a Turing machine, running the simplest possible language, BrainF[uck] (also called BF) - the smallest Turing-equivalent language in existence, having only eight instructions.
As another example, the "minimalism" of Brainfuck has been used to minimise bias when measuring the performance of AI systems: http://arxiv.org/abs/1109.5951 http://arxiv.org/abs/1109.5951
However, when it comes to minimalism, Brainfuck is actually rather complicated. As mentioned above, it has 8 instructions ("+", "-", ",", ".", "<", ">", "[" and "]"), but there are several languages which only require one instruction http://esolangs.org/wiki/OISC http://esolangs.org/wiki/OISC
Brainfuck also separates code from data, which causes it to bloat (eg. we have an instruction pointer into the code and a cursor into memory). Many languages don't do this, for example Turing machines, lambda calculus, and even some of the languages on the OISC link above like BitBitJump http://esolangs.org/wiki/BitBitJump http://esolangs.org/wiki/BitBitJump
Brainfuck also has built-in IO primitives ("," and "."), whereas other languages like Lazy K ( http://esolangs.org/wiki/Lazy_K http://esolangs.org/wiki/Lazy_K ) encode their IO as streams or monads.
Brainfuck also requires arbitrary implementation decisions like word size and memory size, unlike eg. Flump ( http://esolangs.org/wiki/Flump http://esolangs.org/wiki/Flump ) which allows any amount of numbers of any size, written in unary (eg. "11111" for 5) and delimited by zeros (eg. "0111011" for 3 followed by 2).
Brainfuck requires an instruction pointer to keep track of which instruction it's up to in the program, unlike purely functional languages which can be evaluated in any order, like Binary Lambda Calculus http://en.wikipedia.org/wiki/Binary_lambda_calculus http://en.wikipedia.org/wiki/Binary_lambda_calculus
There are also arbitrary implementation decisions like what happens when integers overflow, what happens when the cursor overflows the memory, etc. which are complete non-issues when there's no word size, no external memory, etc.
These other languages can also be easier to implement than Brainfuck. For example, I wanted a simple language to embed in a Javascript search algorithm ( http://chriswarbo.net/essays/optimisation/levin.html http://chriswarbo.net/essays/optimisation/levin.html ) and chose BitBitJump.
The code is at http://chriswarbo.net/js/optimisation/levin_bbj.js http://chriswarbo.net/js/optimisation/levin_bbj.js and is mostly dedicated to the search algorithm. The BitBitJump implementation is just these two lines, inside one of the loops:
mem[read_address(counter, m)] = mem[read_address(counter+m, m)];
counter = read_address(counter+2*m, m);
`m` is the word size (constant during a program execution), `counter` starts at 0, `mem` is an array of bits and `read_address(x, y)` converts those bits into a Javascript int (reading `y` bits, starting at index `x`).
- breadbox 12y ago> Brainfuck is actually rather complicated. As mentioned above, it has 8 instructions [...] > but there are several languages which only require one instruction. True enough, but I would say the crucial difference is that Brainfuck's eight instructions have no parameters, whereas all single-instruction languages use one or more operands in order for their lone instruction to have multiple effects.
- talideon 12y agoInsofar as most Brainfuck derivatives are boring and it's had an excessive impact on the field, I agree with you entirely. Believe me, I'm quite aware of all this stuff: I used to be pretty active on Panu's esolang list back in the day; you're preaching to the choir here.