W3C home > Mailing lists > Public > public-nextweb@w3.org > September 2013

RE: conventions for prollyfills

From: François REMY <francois.remy.dev@outlook.com>
Date: Wed, 25 Sep 2013 18:55:19 +0200
Message-ID: <DUB120-W168B299BCEA936E0BCAF56A52F0@phx.gbl>
To: Brian Kardell <bkardell@gmail.com>, "public-nextweb@w3.org" <public-nextweb@w3.org>
> [polyfills end up shipping the same base-polyfills multiple times].
> [we should have a way to reuse code in this case]

I agree on the principle. I faced similar considerations at some point, wondering how multiple polyfills could reuse the same base infrastructure without harming performance or usability.

I think the only reasonable option is to use a module system. This allows to refer to any polyfilled module, and since there are "module packers" available, it enables people to create a single js file tailored for their real usage, possibly combining multiple polyfills.

That being said, the more I think about it, the more I believe the global namespace is a bad place to live in, even if they are simply cases where you need to be there. 

I would be tempted to wait until ES6 is finalized before making any recommendation, but I'm pretty sure someone will comes up with an ES6-module polyfill and maybe we should settle on that one. In the mean time, I would probably advise the use of AMD/RequireJS or something alike.

Maybe we should recommend building modules for every polyfill from now on to favor code reuse across polyfills. 		 	   		  
Received on Wednesday, 25 September 2013 16:55:53 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:05:54 UTC