Follow @nxtchg

Author Topic: this.  (Read 658 times)


  • Overlord
  • *****
  • Posts: 1115
  • Respect: +61
    • View Profile
« on: July 17, 2017, 08:02:00 am »

A lot of languages copied 'this' from C++ without questioning it.

Now all our objects are littered with it:

Code: [Select]
function seg(fx, fy, tx, ty)
        this.ctx.bezierCurveTo(fx, fy+.5, fx, ty+0.5, tx, ty+0.5);
        this.ctx.lineTo(tx, ty+.5);


Code: [Select]
function signout($nick, $token)
    $this->query("UPDATE users SET token='' WHERE nick='$nick'");
    $this->add('activity', ['type' => 'logout', 'actor' => $nick]);

Why the hell are we doing this to ourselves?!

All objects should first and foremost (maybe ever) access their own members!

Yet we drag this hack, which originated because C++ was a patch on top of C, into all our modern programming languages!

We prioritize access to the global namespace that should actually be prohibited or restricted, like in PHP with the 'global' keyword.


Not questioning things :(

Tentacle Overlord, The Deranged Genius of The Abyss