Open bzbarsky opened 5 years ago
@domenic
Also, is this allowed?
typedef long Foo;
interface Bar {
void func([Clamp] Foo arg);
};
https://heycam.github.io/webidl/#idl-typedefs says no extended attributes apply to typedefs, but presumably that means the actual typedef statement, right? So in this case, does the arg get clamping behavior?
Dang, I'd hoped given that one of the points in my OP of https://github.com/heycam/webidl/pull/286 was about interaction with typedefs, that we'd nailed this the first time around. OK, let me try to reload this into my brain...
and
ClampedLong
is not an "integer type" in the sense linked here, as far as I can tell...
It seems like it should be an integer type. Simpler, it seems to me that given typedef long Long
, then Long
should be an integer type.
https://heycam.github.io/webidl/#idl-typedefs says no extended attributes apply to typedefs, but presumably that means the actual typedef statement, right?
Right, that was definitely the intent there. I guess it should instead say something like
Although it is allowed in the grammar, no extended attributes apply to typedef declarations themselves. (But, the type being given a new name might itself include extended attributes.)
So in this case, does the arg get clamping behavior?
It seems like it should, right? The typedef should be transparent, ideally. https://heycam.github.io/webidl/#idl-type-extended-attribute-associated-with seems to do the right thing, so I guess this is just about whether Foo
is an integer type again?
It seems like it should be an integer type
That would be ideal; it just doesn't seem to be what the spec says right now.
The typedef should be transparent, ideally
I agree.
so I guess this is just about whether
Foo
is an integer type again
Hmm. Yes, I think so...
Consider this IDL:
Is this valid IDL? Per https://heycam.github.io/webidl/#idl-type-extended-attribute-associated-with step 6, the extended attributes "associated with"
ClampedLong
include[Clamp]
. But https://heycam.github.io/webidl/#Clamp says:and
ClampedLong
is not an "integer type" in the sense linked here, as far as I can tell...Presumably the intent is to allow this, right? That should be made clearer.