- From: Domenic Denicola <domenic@domenicdenicola.com>
- Date: Fri, 13 Sep 2013 15:22:44 +0000
- To: Boris Zbarsky <bzbarsky@MIT.EDU>, Anne van Kesteren <annevk@annevk.nl>
- CC: WebApps WG <public-webapps@w3.org>
From: Boris Zbarsky [mailto:bzbarsky@MIT.EDU] >> TC39 and like-minded people are pushing in the direction of the platform being mostly a JavaScript library which would indeed give you exactly those problems... > Why? > There is no reason we can't have macros for commonly used ES-style patterns that people can use by reference in specs. That's supposed to be the purpose of WebIDL. There's a few aspects of this. Ideally, ES6 will give most of the "macros" needed, in the form of class syntax, default arguments, and destructuring argument lists. It's not all you need, certainly, but it does obviate a lot of WebIDL, the largest remaining piece being type conversions, which Yehuda already made a very rough and incomplete start at [1]. Apart from that, the remaining idiomatic patterns will look a lot more like, as you say, macros, instead of declarative interface-definition language. For example, some kind of macro to indicate "iterate over this incoming iterable and/or array-like, and perform the following steps, but throw if not `IsObject(putativeIterable)`". Or one to indicate "let returnValue be `new this.constructor(...args)`". Or "if `x` is outside the range `y` to `z`, throw a `RangeError`". Now that I write this, I am reminded of the "shorthand phrases" I added for promise specs [2]. Hmm. [1]: http://wycats.github.io/jsidl/jsidl.html [2]: https://github.com/domenic/promises-unwrapping/blob/master/writing-specifications-with-promises.md#shorthand-phrases
Received on Friday, 13 September 2013 15:23:21 UTC