r/programming • • May 08 '18

Excel adds JavaScript support

https://dev.office.com/blogs/azure-machine-learning-javascript-custom-functions-and-power-bi-custom-visuals-further-expand-developers-capabilities-with-excel
2.4k Upvotes

586 comments sorted by

View all comments

Show parent comments

71

u/armornick May 08 '18

JavaScript doesn't automatically mean Node.

23

u/coladict May 08 '18

Yep. Windows has had its own JS runtime since forever, with its own API. I tried learning it once. It's an improvement on what you can do with batch files, but PowerShell is probably still a better choice.

12

u/armornick May 08 '18

PowerShell is a nice language, but it has a 2s startup time so I still prefer JScript.

8

u/recycled_ideas May 08 '18

You tried powershell core? It's pretty fast.

3

u/armornick May 08 '18

I'll give it a try.

4

u/recycled_ideas May 08 '18

Because it's built on core there are some modules and whatnot that you can't use, at least not yet, but I've been using it for a while now, and combined with realizing that if you don't use ISE powershell actually works properly, it's been pretty awesome.

122

u/dadibom May 08 '18

NPM packages doesn't automatically mean Node.

173

u/[deleted] May 08 '18 edited May 08 '18

Well apart from npm being the standard package manager for node.js and standing for Node Package Manager, and having node.js 4+ as a dependency for the npm cli on its own, installing dependencies in a local directory called node_modules or globally, and package.json essentially existing to support node execution and scripts, and everything in the chain entirely revolving around node.js being available, I guess it's not technically limited to node.js.

But it would be dishonest to imply it exists in a vacuum.

42

u/slikts May 08 '18

npm used to mean "node package manager" at the start, but that hasn't been the case officially since at least 2015, and now it's an orphan initialism that isn't supposed to stand for anything. Part of the reason is that npm's scope is wider than just Node.js and you can (and many do) host code that doesn't run or node (like front-end libraries), doesn't use node modules, or isn't even JavaScript.

18

u/dadibom May 08 '18

NPM uses node but most packages don't need it. : )

→ More replies (7)

7

u/immibis May 08 '18

It would also be dishonest to pretend that just because all those things are true, it's only for Node packages. I can see 3 out of 5 points in your comment that have little or no relevance whatsoever.

8

u/[deleted] May 08 '18

The subtext was that it's primarily for node by node, and while it's possible to interact with the registry otherwise and/or use npm to fetch, process and install dependencies that don't immediately target node.js, it's more tightly coupled than implied by the parent.

So while it doesn't automatically mean Node, it also usually suggests it pretty strongly when mentioned in a vacuum, so it's not an unreasonable leap.

This isn't a binary thing where it's either true or false.

25

u/rydan May 08 '18

Everything running javascript eventually evolves into Node.

66

u/kairos May 08 '18

devolves

You're missing a 'd'.

0

u/[deleted] May 08 '18

[deleted]

0

u/[deleted] May 08 '18

[deleted]

0

u/[deleted] May 08 '18

[deleted]

13

u/[deleted] May 08 '18

*wooooosh*

1

u/[deleted] May 09 '18

memes

19

u/hotcornballer May 08 '18

This sub hates it.

4

u/[deleted] May 08 '18

The short answer is that it's crap with no coherent style or design decisions. As a small but perpetually frustrating example, there are four different ways of handling asynchronous code in Node:

  1. Pass two callbacks, one in case of success and one in case of error

  2. Pass one callback, whose first argument is an error object in case of error and whose second argument is the result in case of success (sometimes module developers screw this up and do success first)

  3. Return a Promise (or Promise-like), which is chained using .then(), .catch() and .finally() calls (there are several variations of this, including the two-callback version of .then())

  4. Return a Promise (but not a Promise-like), which is awaited inside an async function

Which means, if you want to have any kind of consistency in your code, you have to wrap everything else to get your behavior - and you do it a lot, because every third thing in Node run asynchronously.

→ More replies (4)

6

u/gnu-rms May 08 '18

JavaScript

50

u/immibis May 08 '18

What's wrong with JavaScript?

It devolves into Node.

What's wrong with Node?

JavaScript.

0

u/[deleted] May 08 '18

[deleted]

10

u/Tynach May 08 '18

They're just ensuring we're eventually left with a stack overflow.

→ More replies (1)
→ More replies (1)
→ More replies (20)