you are viewing a single comment's thread.

view the rest of the comments →

[–]ID10T 1 insightful - 2 fun1 insightful - 1 fun2 insightful - 2 fun -  (4 children)

I don't know, prototypes are pretty core to javascript's implementation. In practice, I don't often need to use prototypes, but prototypical inheritance is handy at times. A fun example, overriding the core Date prototype in order to have a unit test that produces the same mock objects every time date is called.

global.Date.prototype.getTime = jest.fn(() => 1609459200000);

As programmers get older, there is a natural tendency to distrust the new, and become set in our ways. "Old fartism" I like to call it. It's important to keep your brain elastic and not fall into this trap, so you don't end up that greybeard in the basement server room, grumbling at everything.

[–]fschmidt[S] 1 insightful - 2 fun1 insightful - 1 fun2 insightful - 2 fun -  (3 children)

I am open to new ideas that come from a reasonable source. For example, I have no problem using Nginx which is from Russia. But the West has become totally worthless and absolutely everything that it produces is crap, and this isn't restricted to software. Looking at anything produced by the West in the last 10 to 20 years is just a waste of time.

Your date example could be easily handled without prototypes if Javascript wasn't based on them. For example, if this was Luan with a global.newDate() method then:

local oldDate = global.newDate
function global.newDate(...)
    local date = oldDate(...)
    function date.getTime() return 1609459200000 end
    return date
end

Stupid Javascript varargs suck, but you get the idea. This is conceptually simpler than prototypes.

And by the way, prototypes are not a new idea. They originated in "Self" in the 1980s and were in Javascript since the beginning in the 1990s. So some old things also suck.

[–]ID10T 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 1 fun -  (2 children)

I believe that particular logical fallacy is referred to as Ad Hominem or Appeal to Authority, depending whether you think the source is reasonable or not.

Yes, javascript was developed (in a few weeks no less) as a prototypical language from the start, that's why I think people should learn that aspect of it to really understand the language fundamentally. But I don't love prototypes either. But that's what the language is, so it should be treated as such.

You obviously don't like anything new, just like Fortran coders hated Java, and Assembly programmers hated Pascal... Ever get the sense that you might just be stuck in your ways, and not open to new shit?

[–]fschmidt[S] 1 insightful - 2 fun1 insightful - 1 fun2 insightful - 2 fun -  (1 child)

You obviously don't like anything new

Lying is another modern trait. Nginx is relatively new and I use it.

[–]ID10T 1 insightful - 2 fun1 insightful - 1 fun2 insightful - 2 fun -  (0 children)

Pretty sure lying has been around for a long time 😂 And nginx will be 20 next year, I mean that's ancient by tech standards...

I'm not trying to fuck with you dude. You are obviously super smart and experienced. I just made a choice a long time ago not to become one of those dusty greybeards stuck in a basement that everybody hates. Don't do that to yourself. Be open to learning some new shit. It's not all bad I swear (lying again I know)