This might be phrased as a question, but I think it’s more like a feature discussion.
As we all know, the Babylon developers take great care to always maintain backward compatibility with every release. Even with the upcoming 5.0 release, everything should still work as-is. That has been a great boost to developers: they can rest assured their code won’t break just because a new release has been uploaded to the CDN.
But this comes at a cost: JavaScript is simply not the same language as it was when Babylon was developed. Promises, async/await, ES6 modules, and TypeScript did not exist back then. Building and maintenance is a hassle to get everything to behave the same. Side-effects significantly increase the build time, size, and complexity. When refreshing a page with a development build, there is a noticeable delay before the web page is available again. There are plenty of other compromises that the core developers have made over the years.
If the next release were allowed to break backward compatibility, what would you like to see done?
Please note: this is a purely theoretical discussion. The 5.0 release hasn’t even been released yet. It will be years before work on a 6.0 begins, even if it does decide to break backward compatibility
Here are some things on my wishlist:
- ES6 modules only. It’s time to stop worrying about IE11. All modern web browsers now support modules. Browsers can import the built modules directly, or tools such as webpack or rollup will bundle them when
- A better build system. No more globally installed Gulp required for contributing. I tried porting the build system to Rollup. You can read about my attempts here and see my old code on GitHub. It required all sorts of special tricks to get all of the same modules (and there are multiple copies of each module that must be built), type definitions, shaders, and everything else to work identically to the current system. I’d like Gulp to be replaced with either Rollup, webpack, or just plain-old tsc and leaving the rest to the browser or application bundler.
-
No side effects by default. This is the root of all evil in Babylon: it makes the file size explode. Tree-shaking just doesn’t work properly with side effects. At the very least, take advantage of modules by having them dynamically imported with something like
async importSideEffects()
. - No callbacks for things like ImportMesh. You all-to-easily get into callback hell once you start hooking things up to the model you just loaded. Callbacks are fine for things like observables but for query-response type APIs, Promises should be used.
- Remove old APIs like WebVR. This one is obvious enough. WebVR is deprecated and shouldn’t be used anymore.
-
Allow WebGPU without additional code. The upcoming 5.0 release will include WebGPU, but it requires a special
WebGPUEngine
. Migrate the regular engine to haveinitAsync
and let the engine choose between WebGL and WebGPU.
Does anyone else have any fantasies about what they would like in a non-backward compatible release?