Fork me on GitHub
#other-languages
<
2016-06-17
>
sveri09:06:54

Is there any tool for javascript that keeps human beings sane? For instance one that hints me that this code

"use strict";
function foo(b) {
    console.log(b);
}
foo(3, 4);
calls foo with the wrong number of arguments? I know about typescript and cljs obviously, but I wonder if something for pure javascript exists?

borkdude09:06:33

@sveri: the arguments declared says nothing about the amount of arguments you can pass to a function in javascript: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments/length

sveri09:06:58

@borkdude: is it really that bad?

borkdude09:06:30

@sveri: it's a design choice (which I don't understand)

sveri09:06:35

Funny that there is also Function.length which holds the number of parameters the functions expects

sveri09:06:14

still that would leave place to a linter that checks if these two things match

borkdude12:06:17

@sveri I'm doing some CoffeeScript atm. In my opinion this language is even worse than JavaScript.

sveri12:06:40

worse? is that possible?

borkdude12:06:10

it depends on how you look at it

seancorfield15:06:51

We had a contractor build us some "JS" stuff and they used CoffeeScript. Told us "It's way better than JS!". Having tried to maintain it for a while, we do not agree!!!

tjg18:06:00

Interesting, might be nice for me to google for Coffeescript critiques.

tjg18:06:00

A while ago, I convinced a (fairly hostile) team to consense on allowing Coffeescript in a Node.js project. (Naturally, I emphasized disadvantages to balance my advocacy.)

tjg18:06:05

Significantly reduced boilerplate of classes & nested callbacks. Though the way it represented datastructures was a step backwards IIRC. (Or was I able to use Javascript notation then for this?) Liked expressing in Coffeescript by default, but Javascript when better.

tjg18:06:49

One advantage is it was fairly simple to convert Coffeescript <-> Javascript, IIRC. (With reasonable amounts of manual polishing.)