News for hackers. Stuff that matters.
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by falcolas on Monday September 12, 2016 @02:55PM (#12482577)
> And it is extremely successful because it's not a bad language.

Perhaps not a bad language, but I do think it falls into the same category as PHP - just good enough.

It's just good enough to do what we want it to do, and given the lack of choice, we're willing and ready to pile abstraction upon abstraction upon it to try and reduce the pain involved with getting work done.

And like masochists, we look at the results and go "Well, that didn't hurt too bad this time, so I'm willing to go do it again."

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by Udik on Monday September 12, 2016 @03:26PM (#12482846)
I don't think you know what you're talking about. PHP, up to version 4 at least, was hardly even a language. More like a collection of macros.

Javascript, despite a few ugly gotchas, is an elegant language with a few simple rules that allow for an impressive degree of freedom and flexibility.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by falcolas on Monday September 12, 2016 @03:36PM (#12482926)
> hardly even a language. More like a collection of macros.

You just described Forth, and a good portion of Lisp. Both of which are great, groundbreaking, and productive languages.

> an elegant language with a few simple rules that allow for an impressive degree of freedom and flexibility

Very eloquently said. However, compared to other dynamic languages like Lisp, Perl, Ruby, and Python, it doesn't strike me as particularly free or flexible. The ability to create and use DSLs directly within those languages really displays true flexibility and freedom, IMO.

Of course, you don't always want unlimited flexibility and freedom in a language; it's why a particular type-safe languages with a very restrictive borrow checker is so popular.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by qwer on Monday September 12, 2016 @04:37PM (#12483417)
DSLs are actually common in javascript. JQuery, one of the most popular libraries in all of javascript is mostly a DSL for DOM manipulation. Lodash/underscore is mostly a DSL for list manipulation.

Admittedly, JS doesn't have operator overloading, but I personally think that's a good thing.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by falcolas on Tuesday September 13, 2016 @11:14AM (#12488970)
We apparently have a very different definition of DSLs. Both jQuery and Lodash are, to me, libraries with lots of functions. A DSL, to me, would be a change in the underlying language being interpreted.

i.e.

    describe file("foo") do
      it { should exist }
      it { should be_owned_by "root" }
    end
vs.

    _.map(["a"], function(s) {alert(s)})
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by spion on Tuesday September 13, 2016 @11:33AM (#12489158)

  describe("something", () => {
    it(should(exist))
    it(should(be_owned_by, "root"))
  });
Also

  _.map(["a"], s => alert(s))
Or just

  _.map(["a"], alert)
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by qwer on Wednesday September 14, 2016 @01:25AM (#12494412)
Except your rspec example isn't a change to the underlying language is it? Also, Check out mocha for the JavaScript equivalent.

Also, when you use only one function of lodash, you can't call it a language, but there are chains and flows for creating powerful pipelines for collection processing.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by goatlover on Monday September 12, 2016 @05:22PM (#12483806)
Operator overloading in Python made the Pandas library possible where you can treat a DataFrame syntactically like you can in R, which is really nice for data science.
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by qwer on Monday September 12, 2016 @06:39PM (#12484256)
"Made it possible", or "made it look like R"? add() vs. + is just a mild inconvenience IMO compared to the inconvenience of overloading abuse that I normally see ( like sqlalchemy IMO). I'd personally rather know what to expect from an operator.
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by goatlover on Monday September 12, 2016 @07:27PM (#12484503)
Also, it adds up (no pun intended). You're right that add() vs. + for a simple case when you only do it a few times is no big deal. But it is a bigger deal when you do it a lot, and the arithmetic can be a little more complicated.

We could by analogy apply this argument to adding integers and floats together. It's more convenient to use the + operator for that, but someone could argue that an add() function is just a minor inconvenience, so why bother overloading the + operator?

That is until you have to use it hundreds of times.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by goatlover on Monday September 12, 2016 @07:19PM (#12484445)
It's not just arithmetic, it's also being able to use comparison operators to filter, which is really convenient. What languages like R do at the syntactic level is make the programming language closer to math, where you can do things like add vectors or multiply matrices using simple operators.
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by tracker1 on Monday September 12, 2016 @03:39PM (#12482973)
Compared to what? PHP is/was far, far worse than JS has ever been, and I remember when you couldn't declare a function in a function (IE3 iirc). There are a few, well defined quirks, and some other behaviors that are arguable, but JS is one of the most expressive languages around, and with the ES2017+ enhancements really nice.

JS is my favorite language, hands down... C# is a close second, and that's as much for the tooling as the language, though the p/invoke and native interfaces are pretty awesome. After that, there's some functional languages I like, and have been looking for a reason to use Rust or Go for something... beyond that, most languages have a lot of their own warts.