W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2015

Re: Writing spec algorithms in ES6?

From: イアンフェッティ <ifette@google.com>
Date: Thu, 11 Jun 2015 13:45:45 -0700
Message-ID: <CAF4kx8dBeNVALAOvdJYmhsRn4xi6ve6bmZYgV89nA3KCuFQ4yA@mail.gmail.com>
To: Dimitri Glazkov <dglazkov@google.com>
Cc: public-webapps <public-webapps@w3.org>
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. When you just list code for what the function means,
that leaves alternate implementations rather ambiguous as to what is a spec
violation and what is not. For instance, stringifiers - what if an
implementation rounds things to some finite precision rather than
multiplying by 100 and spewing out some arbitrary length percentage? is
this correct? Or do you have to just use the code in the spec as given? And
if you use the code in the spec as given and everyone implements in exactly
the same way, why not just publish a library for it and say to heck with
the spec?

2015-06-11 13:32 GMT-07:00 Dimitri Glazkov <dglazkov@google.com>:

> 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 the Web components specs use their own flavor of
> prose-pseudo-code.
>
> I wonder if it would be good the pseudo-code would actually be ES6, with
> comments where needed?
>
> 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
>
> WDYT?
>
> :DG<
>
Received on Thursday, 11 June 2015 20:46:13 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:27:31 UTC