

Fake Operator Overloading in JavaScript (2011) - codecurve
http://www.2ality.com/2011/12/fake-operator-overloading.html

======
lucio
"Authentic Operator Overloading" is already a bad idea, so a "Fake Operator
Overloading" will be a bad implementation of a bad idea. You may better title
the article "Casual inadvertent code obfuscation c++ tools fake-implemented in
javascript: enjoy!" :)

~~~
blubbi2
> While fake operator overloading is a fun hack, you probably shouldn’t use it
> in production code.

> But at the very least, fake operator overloading allows you to impress your
> friends by unusual-looking code.

Couldn't agree more. Please, please don't use this in production.

Edit: Just wrote the following piece of code:

    
    
      coors[0] = ~~cors[0];
    

Damn.

------
TazeTSchnitzel
This is complete insanity, but I love it.

------
pluma
> You probably shouldn't use this in production.

Yeah, that's probably an understatement.

------
vkjv
I've read this article a few articles and it keeps hooking me with a certain
math puzzle.

Is it possible to identify an arbitrarily long string of operations when you
can only control side effects and the return value?

I haven't been able to come up with anything.

------
bobdetemple
in case you don't make it to the end, the closing line is "But at the very
least, fake operator overloading allows you to impress your friends by
unusual-looking code."

------
peterashford
For the love of God, NO!

------
leeoniya
why use this when there's already a perfectly good Brainfuck[1] to impress
your friends.

[1]
[http://en.m.wikipedia.org/wiki/Brainfuck](http://en.m.wikipedia.org/wiki/Brainfuck)

~~~
edibleEnergy
Why use Brainfuck when you can use SNUSP -
[http://rosettacode.org/wiki/FizzBuzz#SNUSP](http://rosettacode.org/wiki/FizzBuzz#SNUSP)

~~~
mikeash
I think Malbolge is the winner in the field of crazy programming languages. It
has no entry on that page, presumably because nobody has managed to write
FizzBuzz in it yet. There is at least a Hello World:

[http://rosettacode.org/wiki/Hello_world/Text#Malbolge](http://rosettacode.org/wiki/Hello_world/Text#Malbolge)

A choice quote from Wikipedia: "Weaknesses in the design have been found that
make it possible (though still very difficult) to write useful Malbolge
programs."

Many languages are deliberately made to be difficult to use, but in the end
they're always made to be used. Malbolge is the only one I'm aware of where
the ability to write programs at all is a "weakness."

