Re: IDL micro-syntax Re: [ReSpec] release 23.2.0

On Mon, Oct 8, 2018 at 4:49 PM Marcos Caceres <mcaceres@mozilla.com> wrote:
> On Oct 9, 2018, at 6:20 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> > On Sun, Oct 7, 2018 at 6:56 PM Marcos Caceres <mcaceres@mozilla.com> wrote:
> >>> On Oct 6, 2018, at 7:17 AM, mcaceres@mozilla.com wrote:
> >>>
> >
> > Wait, that's not necessarily what I meant - without it, how do you
> > refer to an enum value like "foo bar”?
>
> I wasn’t able to come up with a case for that, as for enums I was expecting for instance:
>
> > If {{{ window.screen.orientation.type }}} is "landscape-primary", then do Y.

I'm confused. The point of {{{foo["bar"]}}} was that "foo" was an
enum, and "bar" was an enum value. Your example here doesn't link up
an enum value at all, so I don't understand the relevance.

> Do you mean for a `maplike` or `setlike`? For those I thought calling `.set\get()` would be appropriate.
>
> > {{{ foo.bar.maplikebar.set("enumvalue", otherArg) }}}
>
> Do you have a particular case from a spec in mind?

No, I meant an enum. Enum values are strings. While the *convention*
is that the string has no spaces in it (instead using either naked
concatenation, or dash-separation), there's nothing *preventing* us
from having spaces in a multi-word enum value.  Such enum values, if
we pretend the enum is a JS object with the enum values as keys, can
*only* be written with [] syntax, not with . syntax.

~TJ

Received on Tuesday, 9 October 2018 15:52:30 UTC