The James Webb Space Telescope Runs JavaScript, Apparently
theverge.com
theverge.com
It's a cut-down subset of the language and bolted down to prevent idiots installing random packages off the internet on an irreplaceable $10Bn instrument.
Webb-pack? Amirite?! Heyoh!
<https://brent-noorda.com/nombas/us/devspace/manual/c/html/TH...> (full docs: <https://brent-noorda.com/nombas/us/devspace/manual/c/html/in...>)
Moar:
- <https://arc.aiaa.org/doi/pdf/10.2514/6.2006-5747>
- <https://brent-noorda.com/nombas/history/HistoryOfNombas.html...>
Unfortunately the manual is rather vague; it’s not clear what the ScriptEase language extensions to JavaScript are, versus adding more objects and methods, which I wouldn’t consider to be changing the language.
I am not sure what they are talking about with this page about lifetimes: <https://brent-noorda.com/nombas/us/devspace/manual/c/html/TH...>
JS runtimes are so widely used that they’re extremely well debugged and very fast. The language standard library is tiny, which means much less surface for bugs compared to the hulking default dependency monstrosities of those other languages.
As long as you don’t use anything from the Node or web browser ecosystems, JavaScript is a great embedded scripting language. (Of course everything goes to hell if you bring in node_modules or try to support the bad APIs from browsers.)
> JS runtimes are so widely used that they’re extremely well debugged and very fast.
This would be true if these systems weren't constantly changing, both because the language keeps evolving and the runtime techniques keep evolving.
The truth is that JS runtimes are extraordinarily complicated pieces of software, and they have bugs, sometimes very subtle ones. Sometimes bugs have been hiding for years, and sometimes they are new. This despite being developed by some of the best engineers I have ever worked with, being daily pounded on by billions of people, and fuzzers with thousands of cores.
Seconded as a former SpiderMonkey engineer. As a safety guy, trusting an optimizing JIT is the stuff of my (professional) nightmares and the fact that the language keeps evolving, has semantics that very few people on Earth actually understand fully and that (very smart) developers keep cramming new optimizations within them.
Oh, and add to that the fact that they're pretty much all written in C++, which is already the stuff of nightmares for safety professionals, and that they rely on garbage-collectors that need to walk both JavaScript and C++ heaps.
I would trust a small, certified, non-optimizing implementation of a JS runtime much more than any of the juggernauts out there.
V8 wasn't an option because it couldn't have been for another five years.
Regarding the standard library being small, that's not really about the language but about the deployment of it. V8 offers standard library features you don't get in browser-based JS, you get different things in .NET Core vs .NET Framework, you get a different experience compiling C++ on glibC vs MSVC++'s STL, OpenJDK vs Oracle JDK, etc., etc. Those aren't strictly language features.
You could take Python and rip out all of its standard library in order to have a more "pure" language approach.
Clearly it met specific requirements that the engineers had as a scripting language than others, so it's getting the job done. I just don't think your overall points are actually based in the reality of Javascript as a language in 2003.
JS sucks, but V8 is an incredible piece of engineering. That is true. But they aren't using V8.
So what are you using then?
It wasn't a fantastic experience at the time but luckily for us the stakes were pretty low as we were working on interactive mall map kiosk devices.
What do you have to say to those who have?
I have worked in large JS codebases that predate NodeJS's cannibalization of JS, and it's precisely why I deride the former—because I know from firsthand experience that it doesn't have to be the way that it is, and there are tons of people (too many) operating on the misconception that JS=Node (and inducing others to make the same mistake). Even this article from The Verge contributes misdirected scorn by linking, of all things, to... Maciej Cegłowski's talk about "The Website Obesity Crisis" (wat).
It would be one thing if the person you were replying to had shown up to write "lol leftpad good luck", but that's not what's going on. It's the opposite of that.
Cool, things use to be easier when you were working pre-Node dominance but you weren't shipping the complex interaction patterns that have resulted in the ecosystem we have today.
So frustrating to have conversations with those who have no perspective or context on the why and rest on their laurels of old when "things were easier". Good grief.
Why would I talk about that? The article is about the James Webb Space Telescope, not the James Webb Browser. Aside from that, this is rooted at the mention of "node_modules", which is a NodeJS-ism; browsers don't even run NodeJS modules (unless you recompile them to standard JS), so browsers are doubly irrelevant...
> and how npm itself (you could argue the entire JS ecosystem, along with language changes) has changed
I didn't omit that. I was very explicit about NodeJS cannibalizing JS.
> So frustrating to have conversations with those who have no perspective or context on the why and rest on their laurels of old when "things were easier".
You seem to have me confused with someone else. (Talk about "context"!) Where does that quote from? It looks like you made it up.
1. Use npm.
2. Not feed my family.
I guess I'll use npm.
False dichotomy between 1. and 2..
In reality, there are plenty of interpreters you can embed and be very sure you're not making a mistake. Lisp and Forth are the top of that list, forth far ahead of lisp (literally designed to be used in embedded systems, and much simpler and lower-lever than most lisps). After that, there is Lua and Tcl, both explicitly designed to be embedded and extended, and lua specifically pushing words like "portable" and "lightweight" to the extremities. After that, you have Java (which runs on 3 billion devices!) and even Python, which has micro-variants running on higher end embedded Linux devices. JS is at around this tier.
However, note that JS, with all its warts, has the benefit that its security model has been studied in the harshest conditions for 20+ years. I can't think of any other scripting language that has been battle-tested nearly as much.
Because you really don't want a script written by a end-user to crash down your $10B / 20 years of planned mission hardware.
> I mean that the actual telescope, arguably one of humanity’s finest scientific achievements, is largely controlled by JavaScript files. Oh, and it’s based on a software development kit from 2002.
> According to Nombas’ (now-defunct) website, the latest update to ScriptEase 5.00e was released in January 2003
> next time you’re cursing the modern web for being so slow and wishing that someone would just blast JavaScript into space, you can remember that NASA has, in fact, done that.
If you're curious about how NASA develops software - https://www.fastcompany.com/28121/they-write-right-stuff
Here's a github hosted version https://github.com/stanislaw/awesome-safety-critical/blob/ma...
Oh my. I bet that one has an interesting history! That thought has never even crossed my mind, and I did some fun stuff like include a header twice with different definitions to get a C++ mixin.
Does JWST's imaging censors are 20 years old tech, or the team could used a modern sensor that fits the 20+ years old design specification?
It's not like the JWST folks said "we're going to fly a canon 5D!" and then were 20 years out of date when the JWST flew. Pretty much all of the sensors are built from scratch, using very advanced/specialized techniques. Given that the tech is all custom, including some stuff that probably had to be invented or otherwise figured out to begin with, it's hard to say the "tech is old," given it's just now flying.
In other ways, some of it looks old: one of JWST's main sensors images at 1024x1024. There might be other constraints at play here—how much data you get per pixel is directly related to your telescope's angular resolution and sensitivity of sensor.
Here's a page that discusses the JWST's sensors:
https://webb.nasa.gov/content/about/innovations/infrared.htm...
The journal article linked at the bottom of that page is also quite interesting as it talks about the science of the sensor technology and also the background of astronomer's requirements too. You can find it easily on google with a `filetype:pdf` filter.
There's a big construction project near me where the architect was chosen 20 yers ago and now the costs explode, i was thinking whether this is a cause (outdated plans because one didn't follow through immediately).
In essense, using more off the shelf parts for the Mars rovers is part of the science experiment.
Pathfinder cost <$300M. “Better cheaper faster” became Discovery class missions, “capped” at $500M. Curiosity and Perseverance cost about $2.5B each. Not in the same category.
Supply Chain Risk Management, https://sma.nasa.gov/sma-disciplines/supply-chain-risk-manag...
“NASA’s Reliability and Maintainability (R&M) program ensures that the systems within NASA’s spaceflight programs and projects perform as required throughout their life cycles to satisfy mission objectives.” https://sma.nasa.gov/sma-disciplines/reliability-and-maintai...
The sensors on JWST have are outdated and do have some issues. For instance, some of the microshutter on NIRSpec are stuck (they knew before launching). The MIRI has some image artifacts due manufacturing techniques.
The sensors were bespoke, even nowadays, we can't get sensors like the on on JSWT off the shelf. There isn't much use case for most of them outside space telescope. But we could do better with today technology.
https://www.nasa.gov/mission_pages/webb/instruments/index.ht...
Hubble Space Telescope can also be controlled with a custom DSL directly by researchers, with the only difference being the sandbox location - it's compiled and verified on Earth before being sent to the spacecraft. With JWST, they wanted to modernize things and make scripting more accessible. Of course now the variant they use (ScriptEase) is two decades old already.
BTW, it just occurred to me after writing that that one of the first customers to ever license our software, over the dozen years we were in business, used it to control a camera, while possibly our last customer (NASA) also used it to control a (much bigger) camera. JavaScript: it's a language for taking pictures.
Finally, ScriptEase itself would have too many legal troubles being used by anyone, but I do believe just about everything needs a script language so it can be altered and customized and personalized and applied to infinite new purposes (and not a new one invented every week, just something boring and stable).
If I were to revive something from ScriptEase, I've often thought it should be the ideas behind the test environment around it. Where everything that can go wrong will go wrong and it must still survive.
SE was never "open source" in the standard sense, although almost everyone who licensed it got the source. In the very early nineties I was contact by people to say that what I'd been working on should be "open sourced" in the "free beer" context. I needed money to pay rent, put shoes on the kids' feet, and stuff like that, so didn't understand how to get paid for free software. They said "people will pay you to customize it, or to fix bugs" and I said "it's already ultra-customizable and I don't release software with bugs". I kind of get it now, and if I could talk to my old self I would tell self to open-source at least parts so that there was no reason for anyone NOT to use it. So now I'm working on inventing a time machine to go back and tell myself that and A LOT of more important things, but the time-machine work is going very very slow.
Did you see the Espruino Engine? https://www.espruino.com/
> The JWST isn’t running a web browser where JavaScript directly controls the Mid-Infrared Instrument — it’s more like when a manager is given a list of tasks (in this example, the JavaScripts) to do and delegates them out to their team.
The way I interpret this is that JavaScript programs are used to coordinate missions - meaning, in the script, it is specified what instruments to use and how to configure them. Maybe even a `for` loop to sweep an instrument across a range.
But the instruments themselves don't run JavaScript. Since it's a simple language (at least, compared to the embedded languages the instruments actually run) it presumably makes it easy and safe to configure the satellite. Think of it more as a configuration file written in JavaScript.
You could compare this to video games written in C++ that expose to the user a Lua scripting engine such as World of Warcraft or Garry's Mod.
This comment links to a paper with more info: https://news.ycombinator.com/item?id=19738151
> ScriptEase JavaScript allows for a modular design flow, where on-board scripts call lower-level scripts that are defined as functions.
> The script interpreter is run by the flight software, which is written in C++. The flight software operates the spacecraft and the science instruments.
> The flight software will execute the command sent by the calling on-board script and return telemetry, which will be evaluated in real-time by that on-board script. The calling script will then send status information to a higher-level on-board script, which contains the logic to skip forward in the observing plan in response to certain events
Half of my question was surprise, because I would have thought something like Common Lisp, Erlang, Chez Scheme, Guile Scheme, Chicken Scheme would have been interesting choices. Despite being compiled they have various support for interpreters, embedding, and live update / hot reload of code.
The other half was curiosity because I just didn’t know why JavaScript would be chosen and would like to know. (Hence my question.)
You should post here as your own post about the project. That would be interesting.
And congratulations on having some code running on JWST. It’s gotta be uniquely thrilling.
This was before reliable XMLHttpRequest cross-browser support and several years before Ajax started to push Javascript's popularity.
I feel there is a lesson here...perhaps this is what you do when money isn't your incentive.
Dev 2: hold my beer
Which is all to say it's really far removed from left-pad and the rest of the npm cluster**.