"Symbols and BigInts cannot be faithfully polyfilled, so they should not be used when targeting browsers/environments that don’t support them natively."
Since I didn't know what polyfilling was, I couldn't understand the full implication of the rest of the sentence.
Wikipedia provided a helpful definition:
"In web development, a polyfill is code that implements a feature on web browsers that do not support the feature."
Ok, so that was polyfilling in theory -- using code to patch discrepancies between browsers. But what about in practice? And why doesn't it work for Symbols and BigInts? I decided to hunt down a good example.
"To emulate such behavior, a polyfill would need to analyze the code and replace all such operators with its functions. But doing so is cumbersome and would cost a lot of performance."
But what about Symbols? I found the definition of the Symbol type on MDN:
"Symbol is a built-in object whose constructor returns a symbol primitive — also called a Symbol value or just a Symbol — that’s guaranteed to be unique."
Because these values must be guaranteed to be unique, I can imagine the process to generate them with a polyfill must also be high performance, like that of generating BigInts. That's my surmise, but I was unable to find anything that supported it, so I'd appreciate input here!
The last question I have is:
Why does the AirBnB style guide say Symbols and BigInts cannot be faithfully polyfilled? It seems that they can't be frugally polyfilled, in terms of performance, but I wonder why they used the adjective "faithfully". Does it mean that polyfilling these types changes them in some way?