LoginSignup
18
10

More than 5 years have passed since last update.

以前から Shim(シム)Polyfill(ポリフィル) の違いが気になっていたので、調べてみました。

ググってみると、2ality.com のブログにたどり着きました。2011年12月とかなり古いです。

What is the difference between a shim and a polyfill?

Shim

同ブログから引用します。

Shim. A shim is a library that brings a new API to an older environment, using only the means of that environment.

つまり Shim とは、古い環境で新しいAPIを使うためのライブラリのことを指すようです。
こちらも参考になりました。

Shimの意味 - Qiita
Shim (computing) - Wikipedia

Polyfill

続いて引用します。

Polyfill. In October 2010, Remy Sharp blogged about the term “polyfill” [via Rick Waldron]:
...
Thus, a polyfill is a shim for a browser API.

つまり Polyfill とは、ブラウザAPIのための Shim を指すようです。Web (Browser) API というコンテキストに限定された意味になるようですね(2010年10月のブログで初出?)。
こちらも参考になりました。

What is a Polyfill?
Polyfill (programming) - Wikipedia

まとめ

Shim はプログラミング一般で使われるのに対して、Polyfill は JavaScript、特に Web(Browser) というコンテキストで使われる、という違いがあることが分かりました。

es-shims の GitHub リポジトリなど、まさにその例ですね(厳密には Polyfill だと思いますが…)。

18
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
10