Re: Writing spec algorithms in ES6?

2015-06-11 Thread Anne van Kesteren
On Thu, Jun 11, 2015 at 10:41 PM, Boris Zbarsky wrote: > On 6/11/15 4:32 PM, Dimitri Glazkov wrote: >> I noticed that the CSS Color Module Level 4 actually does this, and it >> seems pretty nice: >> http://dev.w3.org/csswg/css-color/#dom-rgbcolor-rgbcolorcolor > > I should note that the ES code th

Re: Writing spec algorithms in ES6?

2015-06-11 Thread Olli Pettay
On 06/11/2015 11:41 PM, Boris Zbarsky wrote: I would actually prefer some sort of pseudocode that is _not_ JS-looking, just so people don't accidentally screw this up. This one please - otherwise it would be way too easy to think the algorithm would run in the context of the page. But usuall

Re: Writing spec algorithms in ES6?

2015-06-11 Thread Joshua Bell
On Thu, Jun 11, 2015 at 1:45 PM, Ian Fette (イアンフェッティ) wrote: > To be honest this always drove me nuts when we were trying to do > WebSockets. Having code is great for conformance tests, but a spec IMO > should do a good job of setting out preconditions, postconditions, > performance guarantees (e

Re: Writing spec algorithms in ES6?

2015-06-11 Thread Rick Waldron
On Thu, Jun 11, 2015 at 4:53 PM Domenic Denicola wrote: > Some previous discussion: [1] especiallly [2] > > In general I think this is a reasonable thing, but it requires a decent > bit more infrastructure to do things “safely”. For example, consider the > definition [3]. It's generic in its argu

Re: Writing spec algorithms in ES6?

2015-06-11 Thread Elliott Sprehn
I've seen this in some specs, and I found the JS code quite difficult to understand. There's so much subtle behavior you can do, and it's easy to be "too fancy." In the example in the color spec, why does undefined become 0 but not null? Also the properties are actually doubles so there's missing

Re: Writing spec algorithms in ES6?

2015-06-11 Thread Tab Atkins Jr.
On Thu, Jun 11, 2015 at 1:41 PM, Boris Zbarsky wrote: > On 6/11/15 4:32 PM, Dimitri Glazkov wrote: >> I noticed that the CSS Color Module Level 4 actually does this, and it >> seems pretty nice: >> http://dev.w3.org/csswg/css-color/#dom-rgbcolor-rgbcolorcolor > > I should note that the ES code the

Re: Writing spec algorithms in ES6?

2015-06-11 Thread Erik Arvidsson
Dare I say ecma-speak? (Maybe I got stockholm-syndrome?) On Thu, Jun 11, 2015 at 4:47 PM, Adam Klein wrote: > On Thu, Jun 11, 2015 at 1:32 PM, Dimitri Glazkov > wrote: >> >> Folks, >> >> Many specs nowadays opt for a more imperative method of expressing >> normative requirements, and using algo

RE: Writing spec algorithms in ES6?

2015-06-11 Thread Domenic Denicola
Some previous discussion: [1] especiallly [2] In general I think this is a reasonable thing, but it requires a decent bit more infrastructure to do things “safely”. For example, consider the definition [3]. It's generic in its arguments, which I think is nice (but does not fit with Web IDL---wh

Re: Writing spec algorithms in ES6?

2015-06-11 Thread Adam Klein
On Thu, Jun 11, 2015 at 1:32 PM, Dimitri Glazkov wrote: > Folks, > > Many specs nowadays opt for a more imperative method of expressing > normative requirements, and using algorithms. For example, both HTML and > DOM spec do the "run following steps" list that looks a lot like > pseudocode, and t

Re: Writing spec algorithms in ES6?

2015-06-11 Thread イアンフェッティ
To be honest this always drove me nuts when we were trying to do WebSockets. Having code is great for conformance tests, but a spec IMO should do a good job of setting out preconditions, postconditions, performance guarantees (e.g. STL algorithms specifying runtime complexity) and error handling. W

Re: Writing spec algorithms in ES6?

2015-06-11 Thread Boris Zbarsky
On 6/11/15 4:32 PM, Dimitri Glazkov wrote: I noticed that the CSS Color Module Level 4 actually does this, and it seems pretty nice: http://dev.w3.org/csswg/css-color/#dom-rgbcolor-rgbcolorcolor I should note that the ES code there produces semantics that don't match the IDL in this spec (or i