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

585 comments sorted by

View all comments

Show parent comments

11

u/Marquis_Andras May 08 '18

It's the most flexible. Many other languages compile to JS. e.g. Haskell, Kotlin, C.

5

u/Somepotato May 08 '18

something something luajit, esp. relevant given Lua was created to be an easy language for designers and engineers who didn't understand programming, to pick up

5

u/tripl3dogdare May 08 '18

If there's such a thing as a lingua franca in modern programming, it's JavaScript. It only makes sense to go with the language that more people know and understand, and personally I'd take JavaScript over Lua any day even without the popularity factor, because Lua has even more half-crazed, barely-fathomable design decisions behind it than JavaScript does. In the end, all else being equal, it wouldn't make sense to pick a language that's easy to learn over a language that nearly everyone knows already.

5

u/Somepotato May 08 '18

well, false != 0 in Lua, Lua has operator overloads, it's not a detriment to speed to swap metatables (prototypes in JS), etc, so I mean I'd say JS has more grodey quirks than Lua, not to mention speed, and not even to mention that the primary users of Excel will more than likely NOT be previous programmers

not to mention the sheer speed of luajit would be very important in something like Excel.

2

u/tripl3dogdare May 08 '18

I'd just like to point out, since we're at at, that Lua has:

  • 1-indexed arrays with none of the good excuses

  • One of the messiest dictionary/hash systems I've ever seen short of PHP

  • Terrible scoping rules

  • Syntax that can't seem to decide if it wants to be C-style or not

  • A barely-comprehensible class system

  • Among other problems

Whatever technical advantages it may have over JavaScript are in my opinion far outweighed by the user experience - while JavaScript certainly isn't perfect, it at least feels like I'm using a language that knows what it's trying to be even if it fails, rather than a language that can't make up it's mind on anything. To each their own, though - nothing wrong with preferring Lua as long as you know why you prefer it =}

1

u/Somepotato May 08 '18 edited May 08 '18

1 based indexing is again to be easier. The whole 0 based started because c does it. Remember it's not a memory offset, it's an index. Also you can't just say messier hash/terrible scoping without naming any examples, and you claiming the class system is terrible hints at you not having much experience with it to complain about it.

Js most definitely does not make up its mind, why is its truthiness require a printed table? Your examples are really vague so it'd be nice if you at least let me sway your opinion a little bit.

Don't get me wrong Lua has some very weird quirks like ".." vs + and implicit number conversion and no continue statement and more i can't type on mobile I created a fork of to deal with, but js has a lot more imo

1

u/[deleted] May 08 '18

How does c compile to JavaScript?

1

u/Marquis_Andras May 08 '18

Emscripten is an LLVM to JavaScript compiler. It takes LLVM bytecode (e.g. generated from C/C++ using Clang, or from another language) and compiles that into JavaScript, which can be run on the Web.

https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Emscripten

1

u/misatillo May 08 '18

C compiles to JS? And Kotlin?

1

u/[deleted] May 08 '18

Kotlin definitely, idk about C.

1

u/misatillo May 08 '18

I though Kotlin compiled to java bytecode, TIL

3

u/tripl3dogdare May 08 '18

Kotlin typically compiles to the JVM, yes. However, the standard Kotlin compiler can also compile it to JavaScript with relatively little extra effort on the development end.

1

u/misatillo May 08 '18

I had no idea! Thanks for the info :)

1

u/[deleted] May 08 '18

Also, native.

1

u/chucker23n May 08 '18

Why on earth would you want to write such high-level code in C?

2

u/meltea May 08 '18

Eh, wrong question. What you want to do is write a AAA game in cpp and have it run natively in the browser in WASM