Hacker News new | ask | show | jobs
by smlacy 4241 days ago
A brief introduction to "polyfilling" and what that means would be pertinent.

I've never heard that term and have no idea what this is about, nor do I care.

3 comments

As a graphics guy I thought they referred to the algorithms used to fill polygons, but it turns out that "polyfills" in web developer parlance are developer implementations of things that should be standard in the browser but aren't.

E.g. maybe all browsers implement an array sorting function, except for Internet Explorer. So for IE clients you'd load a "polyfill", which would be JS code that implements array sorting.

I'm really glad I'm not a JS developer.

>I'm really glad I'm not a JS developer

Yeah, because other languages don't all have their issues...

"as a graphic guy" implies strongly "C++". Hardly the pinnacle of language design...

Everyone picks their poison, why can't he be happy with the one he's picked?
My sentiments exactly. He doesn't have to piss on JS.
Well, if you never heard that term, and

1) you are a front-end JS developer, perhaps front-end JS development is not for you.

2) you aren't a front-end JS developer, then the post wasn't meant for you, so not much need to explain anything.

3) you were born knowing everything about your trade, so no point posting articles like these.
I was answering to a parent who seems to have deleted his comment.

I'm not suggesting that everybody should know everything about their trade. Polyfill on the other hand is an extremely common thing in the trade. You'd expect a surgeon to know what a scalpel is.

Plus, he put it like: "I don't know what it is and I don't care". How about bothering to Google the names you don't know, instead of demanding everybody else to include introductory terminology lessons in their posts?

It's not very productive to talk down to people, even if it's satisfying to you. There's a better way: http://xkcd.com/1053/
Talking down? I was replying to the parent's "I don't know what this is and I DON'T CARE" comment.

If you don't care, you can always not comment.

If you do care, Google is a keyboard shortcut away, and it's up to you to get informed, not to harass the post autors about not including a terminology section.

How about "I don't know what side-effects are and I don't care" posted for every Haskell post? Or "I don't know what functions are"? Where does this BS ends?

Sorry, I just recoil against phrases like "x is not for you."

You seem to view this individual commenter as a sea of uncaring people, but it's just one person. Change their mind, and their contribution to the "BS" does end.

Even if a response like yours seems deserved, it's not very productive. It certainly doesn't help someone to care more.

Bascially, the Javascript language standard defines a set of default API functions. These have been expanded over time, most notably with ES 5, which added things like .map() to arrays.

However, older browsers like IE <9 do not support ES 5, so if, as a developer, you try to call .map on an array in IE 8, you'd get an error.

A polyfill uses Javascript's awesome ability to add functions to basic types, and extend the language in other ways. So if a browser does not ship with, for example, array.map() itself, a polyfill can do array.map = function() {} and implement it.

That way, a developer can simply use array.map and not have to do a different implementation (fall back on a ye olde for-loop).