TypeScript is about static type checking (and IDE support), what you want dynamic types that are better fits for problem domains. This is a step in that direction (in addition to typed arrays in ES6):
https://github.com/dslomov-chromium/typed-objects-es7 <https://github.com/dslomov-chromium/typed-objects-es7> > On 31 Oct 2014, at 01:15, Zexx <zex2...@gmail.com <mailto:zex2...@gmail.com>> > wrote: > > Hello, > > Isn't optional typing (similar to TypeScript) a good thing? > > Let's say I want to do some image processing. And images can be really huge > nowadays. If I allocate an array of dynamic variables, that array may be 10x > larger than if it was an array of bytes. And I need bytes to store and > process R,G,B,A values separately. So, the array itself could have a > descriptor of the type, and each member of the array can then contain only > the value. > > As things are now, a 32 megapixel image in ES would allocate 32,000,000 x 4 = > 128 million dynamic variables. If each variant takes up 8 bytes, that's 1 GB > per image. Let's say I have two source images, one mask and one output. > That's 4 gigabytes just in images, not counting the application, libraries, > web browser, other running apps, OS, drivers, etc. > > That's a waste of resources. Native apps would need only about 0.5 GB for all > 4 source images, so it would run on a wide variety of devices as opposed to > the ES variant. And thus the author would sell more copies and earn more > money. Instead of getting comments like "Why did you made this crappy slow > app. Learn to program. Competition is much faster". > > If ES is to become a proper, truly versatile language, shouldn't programmer > be allowed to use it's knowledge of the app design to optimize resources? > > Best regards, > > Zex > > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org <mailto:es-discuss@mozilla.org> > https://mail.mozilla.org/listinfo/es-discuss -- Dr. Axel Rauschmayer a...@rauschma.de <mailto:a...@rauschma.de> rauschma.de
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss