Hacker News new | ask | show | jobs
by runlaszlorun 1088 days ago
Overridden undefined?

Omg, that’s awesome. I think anyone feeling like a corporate mindless drone should sneak that into a code base.

And I thought overriding toString() was naughty.

In my defense, on my personal projects I have started using var instead of let/const, snake_case everything, don’t use semicolons, manage my objects with my own prototypical inheritance, and am fucking around with my own shitty Canvas2D widgets. Turns out ditching the DOM and using a Turing complete language still beats the crap out of wrestling with the DOM even if you have to reinvent things like word wrap and text areas.

Oh! And there’s not a framework in sight.

The funny thing this is, my productivity and error rate have way improved. Prob coincidence but I do actually enjoy it much more.

Take that ChatGPT!

edit: I actually write web assembly by hand too. Binary even. And have my own little shim in wasm to override its type safety, put code in my heap space pure von Neumann style, and have my own program counter so I can jump and goto. Can’t wait to start doing self-mutating code.

I know this sounds like I’m being sarcastic here- I often actually am- but I kid you not my error rate has plummeted and its become a blast to program again.

My internet actually slowed to dialup speeds lately so I’m only going to MDN or Stack Overflow if I really have to as well.

‘Modern javarscript’? Hahahaha.

1 comments

undefined couldn't be minified. If you assigned it to an undefined variable early on, any minifier could easily convert it to yet another single-character variable name.

undefined became U (for example). An 8-byte or more reduction per reference. What can I say? Size used to matter. (Been doing JS since 1996.)

If you allow it I think most minifiers nowadays use `void 0` for undefined as it’s smaller.

Though I should try this, using a variable alias for undefined and null would maximize minification.