[webkit-dev] Preferred style for checking for undefined in our built-in JavaScript code?

Darin Adler darin at apple.com
Mon Nov 30 13:53:38 PST 2015

> On Nov 30, 2015, at 11:57 AM, Geoffrey Garen <ggaren at apple.com> wrote:
> For the time being, I like “x === undefined”.
> Long term, I’d like us to switch to “x === @undefined”.
> We use @ to indicate reserved words in built-ins. Currently, “@undefined" does not exist, but the built-in compiler magically transforms “undefined” a safe reserved word.
> The typeof and void 0 code should be fast, but I find it obtuse.

Thanks for all the answers, everyone.

I like Geoff’s proposal.

Seems like we should not have to wait long for the “long term”. It seems that the built-in compiler could start magically transforming “@undefined” instead of magically transforming “undefined” any time we like; likely a simple find and replace job. Or it could do both during a transition period. It could even treat a bare “undefined” as an error if we are worried that we will make that error.

Then perhaps later we could relieve the built-in compiler of those responsibilities if we think that’s important.

— Darin

More information about the webkit-dev mailing list