Skip to content

Support syntax for specifying that an optional record<K, V> has a default value of an empty record<K, V> #1566

@weinig

Description

@weinig

What problem are you trying to solve?

There is currently syntax to specify a default value empty sequence (= []) and a default value default dictionary (= {}), but no way to specify a default value empty record<K, V>.

This is needed to eliminate the invalid syntax used by WebGPU's GPUDeviceDescriptor, which tries to the default dictionary ( = {}) to default initialize the record<K, V> member requiredLimits:

dictionary GPUDeviceDescriptor
         : GPUObjectDescriptorBase {
    sequence<GPUFeatureName> requiredFeatures = [];
    record<DOMString, (GPUSize64 or undefined)> requiredLimits = {};
    GPUQueueDescriptor defaultQueue = {};
};

(I have also filed gpuweb/gpuweb#5529 on WebGPU to remove the invalid syntax).

What solutions exist today?

Today, one can use prose for this.

How would you solve it?

Make either = [] or = {} valid for record<K, V>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    addition/proposalNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express interest

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions