Episode 32: # is the New _: Private Fields in JS with Rob Palmer and Daniel Ehrenberg

By on April 25, 2019 6:48 am

TalkScript Episode 32

Class fields are starting to appear in browsers and transpilers. Even if you know how to use them, you may be wondering what decisions went into their design. We’re joined this week by Rob Palmer of Bloomberg and a TC39 representative as well as Daniel Ehrenberg of Igalia and a co-author of the class field proposals.

We learn about the history of class fields which go all the way back to ES2, why many potential approaches to private fields fail to offer strong encapsulation, and why the # symbol was used as a prefix for private fields. We wrap things up with a discussion of the impact of private fields on library and framework authors, what fears developers have about private fields, and the work being done to educate developers on these new language additions.

Speakers
Nick Nisi on Twitter
Neil Roberts on Twitter

Rob Palmer on Twitter
Rob leads the JavaScript Infrastructure & Tooling (JIT) team at Bloomberg, working on the module loader, system optimizations and the JS toolchain that underpin the Bloomberg Terminal. He is a representative to TC39, Node Modules Working Group participant, and liked TypeScript before it was cool.

Daniel Ehrenberg on Twitter
Daniel is a partner at Igalia, an open source consultancy specialized in the development of innovative projects and solutions. He works on TC39 including the private fields proposal.

Show Notes
Below are links to the resources and topics mentioned during this episode.

TC39 proposal for Class Fields
MDN documentation on classes
Axel Rauschmeyer’s explainer on class fields
Google developer update on class fields
Babel plugin for Class Fields
TypeScript (work-in-progress) support for Class Fields
Cheng Lou’s talk on why we lower common abstractions into the language
The new TC39 website listing all proposals

Listen Now!