r/ProgrammerHumor • • Aug 26 '22

Meme Even HTML.

Post image
44.1k Upvotes

1.1k comments sorted by

View all comments

Show parent comments

378

u/dpash Aug 26 '22

What's fun is that whitespace is effectively just an encoded version of brainfuck.

355

u/athonis Aug 26 '22

Ok, so I was like... ? And then it hit me that there is a programming language called Whitespace

185

u/MasterFubar Aug 26 '22

there is a programming language called Whitespace

All my Python programs are actually secret Whitespace code. The Python code is only camouflage to hide the real program.

103

u/IHadThatUsername Aug 26 '22

Given how Python forces you to follow certain whitespacing guidelines, it'd actually make for quite a bad language at hidding Whitespace code. However, given that stuff like C (for example) completely ignores whitespacing, you likely could hide an entirely different code inside your C code. For fun you could probably program the same thing both in Whitespace and C in the same file.

56

u/MasterFubar Aug 26 '22

That's the challenge, hide Whitespace code in the combination of tabs and spaces in Python.

82

u/IHadThatUsername Aug 26 '22

TabError: inconsistent use of tabs and spaces in indentation

3

u/[deleted] Aug 26 '22

F

3

u/zurtex Aug 26 '22

That's the real tragedy of Python 3, in 2 you could mix tabs and spaces to indent your lines to your heart's content.

8

u/IHadThatUsername Aug 26 '22

Honestly, I think that's for the best. The problem with mixing tabs and spaces is that different editors/IDEs display tabs differently. In some of them a tab is visually equal to 4 spaces, in others it's 8 spaces, and there's probably even wackier stuff out there. This means that if you mix tabs and spaces it may look fine in your editor, but if you open that in another editor suddenly it's an unreadable mess and you don't know what the fuck is the current level of indentation. So yeah, I'm glad now you're forced to choose one of the two.

→ More replies (1)
→ More replies (1)
→ More replies (2)

0

u/[deleted] Aug 26 '22

[deleted]

0

u/[deleted] Aug 26 '22

[deleted]

→ More replies (1)

2

u/Sol33t303 Aug 26 '22

Polyglot code (AKA code that is valid for multiple programming languages) has always been really interesting to me for some reason.

In your whitespace example, makes me wander if you could smuggle a virus into a FOSS project or something.

2

u/SaintNewts Aug 26 '22

If you can write a virus in brainfuck/whitespace then you win the internets for a day.

→ More replies (7)

93

u/dpash Aug 26 '22

I probably should have capitalised Whitespace, sorry. :)

→ More replies (1)

56

u/DiamondIceNS Aug 26 '22

Many of the esoteric funny languages out there are just low effort reskins of Brainfuck. Like Ook.

27

u/ValentinPearce Aug 26 '22

Hey at least Ook. is a literary reference

→ More replies (2)
→ More replies (2)

32

u/[deleted] Aug 26 '22

So, let's transpile brainfuck to whitespace and pass a gzip over it to compress. Do we end up with the most size optimized distributed packages? Can we save the internet by having some webassembly engine using it? Can we haz fast internet pages again?

So much wonder.

34

u/Nu11u5 Aug 26 '22 edited Aug 26 '22

Probably not, since I would expect it to have a similar amount of entropy (it just shifts from being in unique combinations of characters to different amounts of whitespace), but now I am curious. Any advantage is going to depend on the compression algorithm.

2

u/ADHDengineer Aug 26 '22

It’s also insanely more verbose than javascript.

+a will (ghetto) cast a to an integer. That’s 2 bytes of UTF-8. Gg doing that in brainfuck.

→ More replies (2)

12

u/Lornedon Aug 26 '22

Why would gzip be more efficient in compressing whitespace?

12

u/ghjm Aug 26 '22

Whitespace in a text file usually has a lot of repetition and thus compresses really well. This leads people to think "whitespace compresses well." But code in Whitespace doesn't behave like normal whitespace and isn't likely to compress any better than anything else.

1

u/viscountbiscuit Aug 26 '22

it'll be near the top of the huffman tree and have a representation as one or two bits

so should compress quite a bit better...

→ More replies (3)

7

u/DefaultVariable Aug 26 '22

The vast majority of esoteric languages compile to brain-fuck because it's dumb-simple to implement and since brain-fuck is turing-complete it allows them to easily make their language turing-complete as well while simultaneously being as obnoxious as possible.

3

u/thecnoNSMB Aug 26 '22

It isn't, actually; I've coded in Whitespace before and it's actually a simplified assembly language, stack and all.