News for hackers. Stuff that matters.
Re:Where is Ruby Headed in 2021? by zarzavat on Friday November 19, 2021 @02:52AM (#29274841)
Why is JS one of the worst languages ever designed? I've used many languages and JS is one of the better designed ones in my opinion.
Re:Where is Ruby Headed in 2021? by tonyedgecombe on Friday November 19, 2021 @03:37AM (#29275069)
>Why is JS one of the worst languages ever designed?

Implicit type conversions.

Function scoping.

Null and undefined, what is the difference?

Accessing an undefined variable doesn't throw an exception.

Assigning to an undefined variable without var puts it in the global scope.

No integer type.

I could go on and on. The only reason it has become successful is because it has a monopoly in the browser.

Re:Where is Ruby Headed in 2021? by mypalmike on Friday November 19, 2021 @07:25AM (#29276468)
My favorite recent discovery is calling a js function with too many or too few parameters. It'll just go ahead and do it.
Re:Where is Ruby Headed in 2021? by phyrex on Friday November 19, 2021 @10:00AM (#29277841)
There’s an implicit “arguments” function argument through which you can access the extra parameters. It’s JSs way of function overloading
Re:Where is Ruby Headed in 2021? by tonyedgecombe on Friday November 19, 2021 @12:13PM (#29279554)
Which looks like an array but isn't.
Re:Where is Ruby Headed in 2021? by phyrex on Friday November 19, 2021 @01:28PM (#29280557)
There’s a lot of that kind of thing in JS, isn’t there? :(
Re:Where is Ruby Headed in 2021? by handrous on Friday November 19, 2021 @11:57AM (#29279308)
I'd add

- Actually using any of the distinguishing features of prototypical inheritance is nearly always a bad idea, which makes the use of that model in the first place very questionable. One of the cornerstones of the language is pretty much one big foot-gun, to be wholly avoided.

Re:Where is Ruby Headed in 2021? by mypalmike on Friday November 19, 2021 @07:22AM (#29276456)
What is [] + [] in JavaScript?
Re:Where is Ruby Headed in 2021? by regularfry on Friday November 19, 2021 @10:03AM (#29277871)
There is the kernel of a nice idea in JS but so many bad early design decisions can never be walked back.
Re:Where is Ruby Headed in 2021? by eropple on Friday November 19, 2021 @06:59PM (#29284232)
I would argue that TypeScript does yeoman's work in doing much of that walking back.

I plumb forgot that assigning a variable without `var` or `let` put it in the global scope because TypeScript yells at you for it.