Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify that dictionaries can't be the type of attr/constant #940

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -5595,8 +5595,7 @@ and the return type and argument list (matching <emu-nt><a href="#prod-Type">Typ
and <emu-nt><a href="#prod-ArgumentList">ArgumentList</a></emu-nt>) on the right side of the equals
sign gives the signature of the callback function type.

[=Callback functions=] must not
be used as the type of a [=constant=].
[=Callback functions=] must not be used as the type of a [=constant=].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This duplicates the statement on line 6367. I think this should be removed, as the sentence is better fit in the types section.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait never mind, I misunderstood the PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can someone explain this to me? The statements appear identical. How are they different?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change copy-pastes it to the Types - Dictionary types for consistency with other Types sections.

I guess this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So why do we only have the requirement on dictionaries once?

But also, we shouldn't have duplicate requirements. That needs a follow-up issue. (Preserving consistency for now seems okay.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding duplicates and then removing them sounds weird, maybe close this and file an issue to remove the existing ones?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Ah no, the callback function thing is new, please don't just close this)


The following extended attribute is applicable to callback functions:
[{{LegacyTreatNonObjectAsNull}}].
Expand Down Expand Up @@ -6321,8 +6320,9 @@ implicitly understood from context that the map is being treated as an instance
dictionary type. However, there is no way to represent a constant dictionary value inside IDL
fragments.

The [=type name=] of a dictionary type
is the [=identifier=] of the dictionary.
Dictionaries must not be used as the type of an [=attribute=] or [=constant=].

The [=type name=] of a dictionary type is the [=identifier=] of the dictionary.


<h4 id="idl-enumeration" dfn export>Enumeration types</h4>
Expand Down Expand Up @@ -6364,6 +6364,8 @@ callback function type value. See [[#es-callback-function]].
There is no way to represent a constant [=callback function=]
value in IDL.

Callback functions must not be used as the type of a [=constant=].

The [=type name=] of a callback function type
is the [=identifier=] of the callback function.

Expand Down Expand Up @@ -6442,9 +6444,7 @@ The literal syntax for [=lists=] may also be used to represent sequences, when i
understood from context that the list is being treated as a sequences. However, there is no way to
represent a constant sequence value inside IDL fragments.

Sequences must not be used as the
type of an [=attribute=] or
[=constant=].
Sequences must not be used as the type of an [=attribute=] or [=constant=].

Note: This restriction exists so that it is clear to specification writers
and API users that [=sequence types|sequences=]
Expand Down Expand Up @@ -6478,8 +6478,7 @@ being kept by that object. Similarly, any record returned from a
platform object will be a copy and modifications made to it will not be visible
to the platform object.

Records must not be used as the type of an [=attribute=] or
[=constant=].
Records must not be used as the type of an [=attribute=] or [=constant=].

The [=type name=] of a record type is the concatenation of the type
name for |K|, the type name for |V| and the string "<code>Record</code>".
Expand Down