Embracing the reality that this little language has a lot to offerby Joe Honton
As a software developer with decades of professional experience, I've worked with lots of languages. Naturally I've formed opinions about each of them.
Perhaps inevitably, those opinions have evolved as I've moved past the syntax, and began to grasp the gestalt of each language — their innate ability to express solutions to problems.
- A compiler for a new type of Markdown being a complete lossless expression of HTML.
- Electron Desktop Apps for declarative templating and content authoring.
- DOM Components using W3C custom elements and shadow DOM.
- Dynamic Plugins for working with the HTTP request/response cycle without middleware.
- CLI Tools for building better software.
Taken one-by-one we could shrug our shoulders, but taken together the range of possibilities is an impressive feat for a single language.
What I once considered to be a toy language suitable for scripting, I now consider to be a first rate language for general purpose computation.
From its inception to its current state, the transformation has been dramatic. Initially it was designed as a domain-specific language to allow browsers to manipulate HTML. But it has transformed itself into a general purpose language available on servers, desktops, cell phones, embedded controllers, and tiny system-on-a-chip devices.
Considered in terms of isolation, the language no longer suffers from global variable pollution. Instead, it allows variables to be named and used without clashing in a wide variety of contexts:
- Simple functions, where the function can only access its arguments and its locally defined variables.
- Functions within functions (closures), which allow the inner function to have full access to the outer function's variables.
- Functions as arguments (callbacks), where the callback is invoked by the receiving function to perform work on its behalf.
- Object methods, where the function has full access to all of the properties of its class-based object.
- Bound functions, where the stack's
"this"pointer is overridden, guaranteeing independence from the caller's context.
- Namespaced functions (static functions of a class), where the function acts as a simple function which can only be accessed through its class name.
- Iterable functions (generators), where the variables maintain their state from one invocation to the next.
And consider the simplicity of the built-in data types and their seemingly limitless range of values.
- Maps, Sets, Arrays, and Objects have generous support for very large collections, and very few apps ever bump into their ceiling before exhausting the computer's virtual memory limits.
- Numeric value can be as large as 9 007 199 254 740 991 and as accurate as 0.000 000 000 000 000 01. And the built-in Math object has the full set of trigonometric and logarithmic functions, allowing the language to be applied to serious numerical problems.
BigIntobjects allow integer arithmetic to be performed on arbitrarily large values.
TypedArrayallow direct access to heaps on a byte-by-byte basis, making image manipulation a possibility.
- Literal values can be expressed in binary (
0b1111) and octal (
0o17) as well as their more familiar decimal (
015) and hexadecimal (
- Bitwise operations are available in full: AND, OR, XOR, NOT, left shift, signed right shift, and zero fill right shift.
Organizationally, the language allows for grouping things into objects and classes and modules, allowing large problems to be decomposed into manageable pieces.
Code execution is non-preemptive, allowing the developer to know with certainty that any function will run from start to finish without interruption, freeing the developer from worry that other functions may change data that it is working on.
When long-running tasks are scheduled, the developer can use promises with
All told, the possibilities are now far beyond what they initially were back in 1995.
We owe this happy state of affairs to the hard work of the standards committee, the compiler makers, the package distributors, and the library developers.
Ecma International's technical committee TC39 is the vibrant side of the standard. This is the group that meets regularly to decide what new features to add to the language, what precise syntax to use, and what algorithm to follow to implement those features. The blitz of new features we've witnessed since 2015 is due to the tech wizards — from many of the world's biggest tech companies — who work on this committee.
Then there's the library and framework developers who have given us ready-made solutions for so many things: database connectivity, SMTP mailers, WebSockets, and data visualization to name just a few; plus excellent tools to make the software development craft even better: beautifiers, linters, validators, and testers.
From Doubter to Fanboi
onClick function for search engine optimization (SEO) that I called
nomojo, because it kept Google PageRank from sending juice to external hyperlinks. At the time,
onClick handlers were pretty much state-of-the-art.
Yet it was hard to take the language seriously when every variable was global by default. It wasn't until
strict mode became widely available in 2012 that developers could safely localize their variables with certainty using
For me, the writing was on the wall: 2015 was the year that I registered the domain name ecmascript.engineer and began using it as my professional portfolio gateway.
export were good to go without a transpiler.
Finally, allow me to close with a parting thought and encouragement to everyone out there hoping to find the next great programming language. Here's a tip: it's right in front of you, and it's not going away any time soon.