all 13 comments

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

Or just use Haskell in the first place.

Simple, clean and extraordinary easy to reread, once you get used to some wanted side-effects.

Javascript is more likely usable for guys and gals that are used to write their stuff in enigmatic illuminati bs like Perl is the grandfather of. Or Ada Lovelaces second voice. Who knows.

Good guys and gals of this flavor should use Rust or LISP, if they feel nostalgic.

If you don't want too fancy stuff because your the programming slave of some propaganda mill of the web "0.2" you also can do your blog or simple archive website in pure c, fyi.

[–]TaseAFeminist4Jesus 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 1 fun -  (4 children)

Yeah, the addition of "class" was very unwelcome, IMO. That C++ / Java / C#-style OOP has been a huge detour in software engineering.

It's telling that if you switch to a really powerful language, like a Lisp derivative, any need for that "Gang of Four" crap just goes away.

JavaScript's original, protoype-based inheritance was OK. I think it's a little unfair to even call it OOP. When I say "OOP," I am referring to the "class" keyword and all the horseshit you see in C++ / Java / C#.

[–][deleted] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 1 fun -  (3 children)

When I say "OOP," I am referring to the "class" keyword and all the horseshit you see in C++ / Java / C.

C doesn't even have classes, it just has structs, it isn't really the same paradigm as Java/C++. I think this approach is implemented quite well in the Rust language.

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

Sorry, I meant C#.

[–][deleted] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 1 fun -  (1 child)

ahh, yeah, that makes sense

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

Plain old C is based.

I need to look into Rust.

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

I agree in the sense that classes are needless syntactic sugar on a prototypical language. It confuses beginners since javascript objects have properties that are unique compared to other object-oriented languages. So trying to basically fake class based programming keeps you from diving into javascript's deeper prototypical behaviors, which are really important to get a solid foundation in JS.

[–]fschmidt[S] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 1 fun -  (5 children)

Yes classes are the worst part. But the whole idea of prototype-based languages makes no sense to me either. Classes make a lot of sense for a statically types language like Java since they are actually core to the implementation. But prototypes are not really core to implementation, they just reflect an idea about how one should program, an idea I disagree with. So I don't use prototypes in Javascript. In fact I recently removed prototypes from SCEditor here.

[–]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)