Breaking all the rules
In most of my programming, I try and remain professional, and do things in a readable, maintainable way, that doesn't involve pushing the language to breaking point.
But, occasionally, I give myself free reign. What if you didn't care about the programmer who came after you? What if you didn't care about what a programmer should do in a certain circumstance?
For myself, over the years I've written and rewritten a C library, I like to call CNoEvil. Here's a little taste of what you could do:
#define EVIL_IO
#define EVIL_COROUTINE
#include "evil.h"
proc(example, int)
static int i = 0;
coroutine();
While 1 then
co_return(++i);
end
co_end();
return i;
end
Main then
displayln(example());
displayln(example());
end
(And yes, that compiles. Without warnings. Even with -Wpedantic
.)
So... Here's the challenge:
Ignoring the rules, and best practices... How can you take your favourite programming language... And make it completely unrecogniseable?
(Might be best to choose a language with macros, like Nim, Rust, any of the Lisps. Though, you can still do some impressively awful things in Java or Python, thanks to overloading inbuilt classes.)
Challenge Ideas:
- Make Python look like C
- Make Java look like Python
- Make anything look like BrainFuck
I don’t know how to really explain my fascination with programming, but I’ll try. To somebody who does it, it’s the most interesting thing in the world. It’s a game much more involved than chess, a game where you can make up your own rules and where the end result is whatever you can make of it. - Linus Torvalds
Now make your text editor hide all the
;
and{}
!I can imagine the slow-dawning horror of a fellow coworker stumbling upon this... Though, if you don't mind one tiny change, it might just make it prettier.
The worst, most horrifying and best part of this is how you went out of your way to use ’ instead of '.
Honestly that was because I typed it on my phone, I had to correct the quotations on the string manually.
I once had to help someone debug their code because their editor placed smart quotes instead of ordinary quotes. One of those really subtle bugs you don't really think about or notice. Worse still, I once had to debug HTML (yes, fucking HTML of all things) because it was unexpectedly broken due to the existence of a non-breaking space in non-entity format--meaning, it looked exactly like every other bit of whitespace on the screen. You can probably imagine how fun it was tracking that one down.
Kind of a tangent, but this discussion brought those horrible memories to surface :)
I'll share a bit from wrapper that I wrote about a year ago. It is public repo on GitHub and has about 2500 downloads.
It mines data from api, here's example: