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

Re: Writing spec algorithms in ES6?

From: Elliott Sprehn <esprehn@chromium.org>
Date: Thu, 11 Jun 2015 14:06:36 -0700
Message-ID: <CAO9Q3iKhf507bTw=dOe6q84TS08g058HfoNwEQ+99vfbzJPpgw@mail.gmail.com>
To: Erik Arvidsson <arv@google.com>
Cc: Adam Klein <adamk@chromium.org>, Dimitri Glazkov <dglazkov@google.com>, public-webapps <public-webapps@w3.org>
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 type coercion
in that pseudo code I think.

On Thu, Jun 11, 2015 at 1:50 PM, Erik Arvidsson <arv@google.com> wrote:

> Dare I say ecma-speak?
>
> (Maybe I got stockholm-syndrome?)
>
> On Thu, Jun 11, 2015 at 4:47 PM, Adam Klein <adamk@chromium.org> wrote:
> > On Thu, Jun 11, 2015 at 1:32 PM, Dimitri Glazkov <dglazkov@google.com>
> > 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
> >> 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?
> >
> >
> > I love the idea of specifying algorithms in something other than English.
> > But I'm afraid that ECMAScript is not a good language for this purpose,
> for
> > the same reasons Boris cites in his response (which arrived as I was
> typing
> > this).
> >
> > - Adam
>
>
>
> --
> erik
>
>
Received on Thursday, 11 June 2015 21:07:45 UTC

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