At Bloomberg, we <3 Open Source. This might come as a shock to those who view Bloomberg solely as a giant financial news company. Truth is, at our core, we’re a tech company. Surprise! As a tech company, we’ve been around a lot longer than many of our peers. Mike Bloomberg set up shop in 1981. A decade later, Linus Torvalds announced his new creation, Linux. Today, the use of open source software is at the heart of our engineering culture.

Many of our 6,000+ software engineers around the globe contribute to open source projects and programming language specifications. This is good for business, good for our engineers and good for the entire developer community. We have made a deep investment in JavaScript, through contributions to core projects and ongoing participation in standards notably for the language itself.

Bloomberg <3 JavaScript

We have one of the largest JavaScript codebases in the world. In 2001, we started powering our core product, the Bloomberg Terminal, with Mozilla’s SpiderMonkey. Now we have more than 10,000 frontend apps and tens of millions of lines of code that cover both our consumer web and professional services products.

I joined Bloomberg in 2017 to work on the infrastructure for the Bloomberg Terminal. I was pleased to discover that a big chunk of this infrastructure runs on JavaScript. Thousands of software engineers throughout Bloomberg started relying on tools I worked on to make their JavaScript better and bug-free. One of my jobs became working to make our applications and their code compatible with the best tools provided by the JavaScript community, with Node and TypeScript being cornerstones of this new generation of developer experience.

One thing that always held true in my time at Bloomberg is our attempt to use the language to its fullest potential. Despite using multiple engines and runtimes, the common theme is that we depend on JavaScript. As a result, we have a permanent mission to further enhance the health of the JavaScript ecosystem.

Bloomberg @ TC39

One of the best venues to improve JavaScript is TC39, the ECMA Technical Committee that defines the JavaScript language. Bloomberg is an Associate Member of ECMA International. We send delegates to participate in TC39, including Rob Palmer, one of the four group co-chairs.

As a TC39 delegate myself, I attend the committee meetings with my colleagues to keep up with the new changes coming into the language, as well as helping advance features that matter to us. We helped implement Private Fields in both Babel and TypeScript, which ultimately paved the way for their implementation in browsers.

Two of our delegates, Philipp Dunkel and Jason Williams, are part of the Temporal champion group that also includes engineers from Microsoft, Google and Igalia. This is a game-changing proposal for date and time handling.

My colleague Rick Button and I wrote the first draft of Record & Tuple just over a year ago. This proposal advanced to Stage 2 (out of the 4 Stages) in July 2020. Record & Tuple introduces first-class immutable data structures to JavaScript.

Dates and times that makes sense: The Temporal proposal

Temporal is a Stage 2 proposal that brings a modern Date/Time API to JavaScript. Temporal will bring immutable date values that can be represented in local calendar systems and time zones.

Temporal will be a new global object that acts as a namespace, just like Math.

Here is a brief usage of Temporal, showing when the conference starts:

const date = Temporal.Date.from({ month: 11, day: 2, year: 2020 });
const time = Temporal.Time.from({ hour: 8, minute: 45 });
const dateTime = date.toDateTime(time); // Temporal.DateTime
const timeZone = Temporal.TimeZone.from('Europe/Dublin');
const instant = dateTime.toInstant(timeZone); // Temporal.Instant

You can play with Temporal today and give feedback. The docs, polyfill and cookbook are available here.

Immutable data-structures: The Record & Tuple proposal

Impressive libraries such as Immutable.js and Immer demonstrate the immediate value of immutable data-structures. Record & Tuple takes inspiration from them and provides this capability as a fundamental building block of the language using familiar object/array-like syntax.

const myRecord = #{ conference: "NodeConf", year: 2020 };
const myTuple = #["NodeConf", 2020];

However, the biggest feature of Record & Tuple is not immediately visible: you can use === to deeply compare them by value. Records & Tuples are effectively multiple values compounded together into a single structure with value semantics.

#{ conference: "NodeConf" } === #{ conference: "NodeConf" }; // true!
#["NodeConf", 2020] === #["NodeConf", 2020]; // true!

Try doing this with objects and arrays: it won’t be true because they are compared by identity!

Workshop: The bleeding edge of JavaScript

We are proud to sponsor NodeConf Remote. As a major participant in the JavaScript ecosystem, it makes sense for us to support this wonderful conference. Last year, we ran a workshop on TypeScript at NodeConf EU. Now that TypeScript has taken over the world, we think it’s time to show something new!

That is why we want to run a workshop this year unlike any other you’ve seen before. Some of the Bloomberg folk who are working directly on the language will be presenting and then demonstrating how to get your hands dirty with the forthcoming Temporal and Record & Tuple features. These features are still experimental, so we don’t advise you to use them in production just yet. But, this will hopefully give you a good idea of what the future of JavaScript will look like!

Visit nodeconfremote.com to register for NodeConf Remote and learn more about the Bloomberg workshop.

 

This blog was written on behalf of Bloomberg by Robin Ricard, software engineer at Bloomberg and TC39 delegate, with the help of Albert Lash IV, Jason Williams, Robert Palmer, Thomas Chetwin, Masud Rahman and Chaim Haas. Bloomberg is a platinum sponsor of NodeConf Remote 2020.

View all posts  |  Technology  |  Business  |  Culture  |  Opinion  |  Design
Follow us for more information on this and other topics.
Published by Guest Author
15th October 2020