GJS: What’s next?

In my last post, I went into detail about all the new stuff that GJS brought to GNOME 3.24. Now, it’s time to talk about the near future: what GJS will bring to GNOME 3.26.

Javascript engine

The highest priority is to keep upgrading the Javascript engine. At the time of writing, I’ve got SpiderMonkey 45 almost, but not quite, working, and Mozilla is on the verge of releasing the standalone version of SpiderMonkey 52. If we can get there, then we’ll finally be on a supported release which means we can have a closer collaboration with the Mozilla team. (During the past six months, they’ve been patient with me asking questions about old, unsupported releases, but it’s not fair to ask them to continue doing that.)

I plan to upgrade to 45 but not merge it, and then immediately continue upgrading to 52 on the same branch, then merge it all in at the same time. That way, we won’t have an interregnum where everyone has to build SpiderMonkey 45 in JHBuild and Continuous and the Flatpak SDK. Subscribe to bug 781429 and its offshoots if you want to follow along.

The main language features that this will bring in are: classes (45) and ES7 async/await statements (52). At that point, the only major ES6 feature that we will still be missing is modules.

ES6 Classes

After that is done, I will refactor GJS’s class system (Lang.Class and GObject.Class). I believe this needs to be done before GNOME 3.26. That’s because in SpiderMonkey 45, we gain ES6 classes, and I want to avoid the situation where we have two competing, and possibly incompatible, ways to write classes.

ES6 Modules

Full ES6 module support is still missing in SpiderMonkey 52, but at least some parts of it are implemented. I’ll need to investigate if it’s possible to enable them in GJS already. Although, we will definitely not enable them yet if there’s no way to keep the existing modules working; we don’t want to break everyone’s code.

Developer tools

Next comes a debugger. There are not one, not two, but three existing implementations of a GJS debugger sitting unattended in Bugzilla or a Git branch. None of them will apply to the codebase as is, so my task will be to fix them up, evaluate the merits of each one, and hopefully come up with one patchset to rule them all.

Christian Hergert is planning to add a profiler, so that you can profile your Javascript code with Sysprof, inside Builder.

Documentation

I would very much like to get the GJS documentation browser back online. I hosted it on EC2, but I have run out of free hosting. If you have a server where it can be parked, let me know! (It’s a web app, not static pages, so I can’t just put it on GitHub Pages.) If you want to run the web app locally yourself, you can find instructions here for how I set it up on EC2, on a RHEL 7 box.

Misc.

All that is probably more than I’ll have time for, but here are some of the things that I’d like to get done after that:

  • Update the tutorials on developer.gnome.org to use more modern GJS
  • Better integration with Builder
  • Use structured logging to clean up the “debug topics” mechanism
  • Reduce the list of unreviewed patches in Bugzilla down to 0
  • Find ways to bring in some of the conveniences that Node developers are used to

Chun-wei Fan is working on converting some of the codebase to use C++ smart pointers so that we get the memory leak safety advantages of g_autoptr without losing portability to MSVC.

Build system

The question is inevitable: are we going to switch the build system to Meson? I’m looking forward to it, but no, not until Meson is more mature and some of the open questions about distribution and autobuilding have been answered.

Help!

I think it’s great that once I started contributing, other people soon started contributing too. The 1.48.0 release had way more patches and contributors than 1.46.0, even if you don’t count all the stale patches that I souped up. GNOME’s #javascript IRC channel is starting to be a lively place, compared to how deserted it was last year.

What I’d most like to encourage is for more people to contribute major features so that the above list doesn’t read like a to-do list that’s mostly for me. I’m happy to provide guidance. I think it would be great for GJS to become a more competitive development language for apps using the GNOME technology stack1 and we won’t get there with just me.

Another way you can help is by using the development version of GJS while developing your apps or GNOME Shell, thereby helping to try out the new features. We had some serious bugs up to, or even past, the last minute in GNOME 3.24, and this seems like the best way to prevent that.

Finally, you can help by sharing your experiences with GJS: good and bad. Talk on the mailing list or IRC, or file a bug on bugzilla.gnome.org if there’s something wrong.


[1] In that regard I’d love to prove wrong Michael Catanzaro’s opinion about using GJS: “there’s no way to change the reality that JavaScript is a terrible language. It has close to zero redeeming features, and many confusing ones.” There is a way! In my opinion ES6 and ES7 have gone a long way towards filling in those potholes. To name just a few, arrow functions mean you can almost always stop caring about the pitfall of what this refers to, and the prospect of doing asynchronous I/O with Promises instead of callbacks actually makes me want to use JS. Of course, in-browser JS is still a terrible language because it has to support the lowest common denominator of Javascripts so that people who haven’t upgraded their browser since Internet Explorer 8 can still visit your website, and that’s why modern web developers preprocess and transpile it to high heaven. But we don’t have to care about all those browser users!

Advertisements

As long as you fight back

Here’s the text of the letter that I sent to my representatives in the US Congress today. (I don’t live in the US, but I’m a citizen of it, and I vote.)

Dear {name}:

As I’m sure you’re aware, the President’s first destructive week in office has left many Americans fearful of whether the values of our country will continue to be carried out. You are part of the last line of defense.

As a US citizen who has lived abroad for over 20 years and been through the immigration systems of two countries, the President’s recent executive order on immigration has struck a particular chord with me. It is a cheap shot to fan the flames of xenophobia, and more refugees — not some abstract concept, but real people — will likely die because of it.

I urge you, as my representative, to do everything you can to obstruct and dismantle policies that fly in the face of decency, compassion, and what our country stands for. I am asking you to go beyond what a member of Congress usually does: these are unusual times and the current administration is not playing by the same rules that you and I are. I am asking you never to compromise and never to let up the pressure. If you want to practice bipartisanship, then reach out to those few Republicans who have not sold out. Freeze out the Republicans and Democrats who have.

This will not be an easy ride for you, but as long as you fight back, you can count on my vote.

If you are a US citizen and want to do something similar, here are some links to where you can find who represents you in the Senate and the House. (Note that to find your House representative, you need to enter your address or your extended 5+4 zip code, because of congressional district gerrymandering. Both of your state’s senators represent the whole state at large, so contact both of them.)

 

Endless is Here

For the past 2.5 years I’ve been working at Endless Mobile on something that was mostly secret. You probably caught me being vague about “computers for developing countries.” Well, secret no longer. I am excited, proud, and honestly a bit relieved to be able to say that I can finally tell you what it’s all about.

“Tell you” is a bit of an exaggeration, I’ll let the videomaking skills of my coworker Taylor Morgan show you instead. The video is at the top of our Kickstarter campaign.

We’re launching our first product, via Kickstarter. It’s a computer that’s affordable for people in developing countries, and it looks like this:

Endless One

Alien Egg

I’ve been working on writing applications for this computer, and also contributing to some parts of the operating system. Some parts of this are open source, and you can view them on GitHub.

Also, I have colleagues who are really fun to work with. If you happen to like fun and are looking for a job, there are some positions open… (It’s at the bottom of that page.)

Update: Within only four days, the Kickstarter campaign hit the original goal of US$100 000. It’s incredible. My favorite part is that almost $30 000 of that money was donated by people paying to give a computer, rather than buy one for themselves. Enough people asked for the option to donate a computer directly, so it was added. Also you can now get the whole package for yourself: computer plus swag, because enough people asked for that too.

 

Discretization, Part II

In this post I described how I encountered the Sell Your Science contest and was entirely fed up with how they perpetuate the myth that scientists are a bunch of timewasters and that marketable research is the only research worth doing. I wrote the organizers, Science Alliance, a letter and urged other people to do the same. Well, it took fewer letters than I expected for something to happen.

My coworker Jelmer Renema wrote them a more strongly worded e-mail than I did. Today he got a telephone call from someone from Science Alliance who wanted to talk about the e-mail. The outcome of the telephone call was that the Science Alliance employee said they didn’t mean that economic gain was the only valid reason for science; social relevance and curiosity from the public are important too. He admitted that the blurb could have been worded differently, although he claimed that there was a large group of scientists opposed to bringing research to market. No, Jelmer told him, nobody’s opposed to that — they’re opposed to the idea that marketable research is the only worthwhile research. In the end, Science Alliance promised to do better next year and Jelmer offered them his assistance in matters of science communication.

By coincidence, an interview appeared in the Delft University newspaper this week. Professor Piet Borst, former scientific director of the Dutch Cancer Institute, says that the whole ‘valorization’ business has gone too far and gets quite angry about it (translation mine):

“We are going about this in such an absurd way. There’s really no other way to put it. [The ministry of] Economic Affairs is living in the 1970s, they think like this: ‘Those wretched university researchers and other academics, busy only with their own hamfisted hobbies, we have to force them to do useful work, and we can only do that by making them dependent on industry financing. They need guidance from our watchful industrialists over what they do.’ They’re delusional. It’s a recipe for how to do it wrong.”

Note that this man isn’t one of those mythical ‘hermit scientists’ either: he says in the interview that those who do research with public money have a duty to allow their findings to be turned into products, which create jobs.

One other important point that Borst makes is that if you, as a researcher, have a significant stake in a spinoff company, then can you really be trusted to publish findings that will cause your shares to plummet? As the interviewer says in the article, “The answer is obvious once you’ve asked the question.”

Discretization is the better part of valorization

V is for Valorization. What’s that? A buzzword coined by the Dutch government that signifies how all scientific research should make money, and lots of it, sooner rather than later. It’s certainly not an English word, as evidenced by the quizzical looks on the faces of physicists who haven’t been working in the Netherlands lately, when some official government delegate gets to make a speech at a Dutch physics conference and says, beaming into the audience, “We are ferry heppy to see so much fellorizable research going on here!”

(UPDATE: Merlijn van Deen reports that valorisation is, in fact, a borrowing from French, where it is used in the same context of scientific research as in Dutch. In English, according to Wikipedia, it is used only as a translation of the German Verwertung, a technical term coined by Marx in Das Kapital meaning to add surplus value to capital by human action.)

I don’t fit the popular caricature of a scientist who thinks all research should be pure and untouched by worldly concerns. On the contrary, I have a Master’s degree in applied physics. One of my current projects is to build a new kind of wavefront sensor that works on a different principle than the commercially available ones. I’m firmly of the opinion that the original reason for this ‘valorization’ policy is quite sound: to get academia and industry interested enough in each other so that academia’s more marketable efforts get passed on to industry instead of dying the death of obscurity in a professor’s filing cabinet, and industry knocks on academia’s door when they have an interesting problem to solve with a longer time-to-market.

But it’s been blown all out of proportion now. The government has declared some research more valuable than other research: fields like high tech systems and energie (energy) are now designated topsectoren (top sectors,) research to which funds should be diverted at the expense of all other research. They are headed by topteams (top teams) each including a captain of science and captain of industry, which draw up innovatiecontracten (innovation contracts) that are required to hit each vertex of the gouden driehoek (golden triangle) of kennis, kunde, kassa (knowledge, expertise, and cash.) It will be successful in making the Netherlands #1 worldwide in the use of buzzwords, which I’ve italicized and translated (only where necessary, since half of them are in English anyway to make them sound more important.) If you read the actual documents, you get the feeling that the government is telling the big companies, “Hey! Want some cheap contract research? We’ve given those scientists free rein for too long and it’s time they worked for you to redeem themselves!”

The thing that spurred me out of lethargy was this, the Sell Your Science contest. You have to make a 90-second video about your research and the winner gets the title “Best Science Communicator of the Netherlands.” Sounds great. But it turns out that you literally have to sell your research: in the description, they treat ‘the audience’ and ‘investors’ as one and the same! I’m sorry, but science communication and sales pitches are two different things. Nothing wrong with a sales pitch contest, but at least call it by its rightful name!

Science crosses borders that politics doesn’t, so it may not have even occurred to their bureaucrat brains that they’re shutting out a large share of the scientists in the Netherlands, who are not Dutch and might not speak it well enough to read the rules of the contest which aren’t in English.

And this part really makes my blood boil (translation mine):

Nowadays, it’s not enough just to write scientific articles and to talk to people in your own field. A broader, open attitude towards society is expected, and valorization sections are required in NWO grant applications. The modern scientist will have to communicate differently and more widely in order to propagate their research.

I explain exactly why this makes my blood boil in the letter that I sent them on May 10. My own English translation is reproduced below. It’s been two weeks and I’ve received no reply. So I’m sharing it:

Dear Sir or Madam, (cc: editorial office of the Leiden University employee newsletter)

I read about the ‘Sell Your Science’ contest in Leiden University’s employee newsletter, and from there I clicked over to the website www.valorisatie.nu. My astonishment was boundless when I read there that this contest is failing to distinguish between the two entirely disparate concepts of ‘science communication’ and ‘science valorization.’ I would like to take a moment of your time to explain why I think this is wrong.

Science communication is, as you say, presenting research to a broad audience in a clear and understandable way. But is that the same as ‘valorization’? Only if one assumes that the broad audience is exclusively interested in marketable research. That is a dangerous fallacy.

The passion that drives a researcher to be good at science communication usually doesn’t spring from the commercialization of research. It’s likely that someone who’s motivated by commercialization won’t choose a career in research. These days, there are those who would rather deny that, but it’s a fact. The description of Sell Your Science, in which scientists are portrayed as hermits, only speaking to their fellow scientists and avoiding contact with society, and in which you say that the ‘modern’ scientist has to start doing things differently, feels like a slap in the face of my profession. There are countless scientists, both in the past and in modern times, who may not necessarily be oriented towards industry, but do stand 100% squarely in society. These people are marginalized by the tendentious introduction on the website. ‘Hermits’ may exist, it’s true, but they are a small minority.

Anyone that I’ve ever encountered who’s been good at communicating science, was able to captivate their audience using their dedication and passion, no matter what the economic value of the research was. Good science communication makes sure the audience has learned something by the time they leave. Good science communication fans the sparks of curiosity in the audience, so that someone, the day after or the day after that, might just hit upon the idea to ask “How does that work, anyway?” A scientist who can captivate an audience (apparently, a hostile one at that) with ‘unmarketable’ science and at the same time, manages to convey its importance despite its unmarketability, is a much better candidate for the title of “Best Science Communicator of the Netherlands” than someone who can sell ‘marketable’ science to investors. That’s the difference between ‘science communication’ and ‘science valorization.’

Sincerely,
Philip Chimento
PhD student, physics
Leiden University

Writing letters seems to have had an actual effect — read Part II.