Re: [mediacapture-main] Fitness distance steps 4 and 5 are inconsistent with the rest of the spec (#933)

> Steps 4 an 5 refer to settings dictionaries as if they were IDL dictionaries, having members. But settings dictionaries are not IDL dictionaries and their internal structure understood to be an implementation detail elsewhere in the spec.
> ...
> If they're not necessarily IDL dictionaries we shouldn't link to the definition of IDL dictionaries when talking about existence of fields.

There's no reference to WebIDL in [step 4 or 5](https://www.w3.org/TR/mediacapture-streams/#dfn-fitness-distance):

4. _"If constraintValue is a boolean, but the constrainable property is not, then the fitness distance is based on whether the [settings dictionary](https://www.w3.org/TR/mediacapture-streams/#dfn-settings-dictionary)'s constraintName member [exists](https://infra.spec.whatwg.org/#map-exists) or not"_. 
5. _"If the [settings dictionary](https://www.w3.org/TR/mediacapture-streams/#dfn-settings-dictionary)'s constraintName member does [not exist](https://infra.spec.whatwg.org/#map-exists), the fitness distance is 1."_

These link to https://infra.spec.whatwg.org/#map-exists, making _settings dictionary_ an [ordered map](https://infra.spec.whatwg.org/#ordered-map), a [common data structure](https://infra.spec.whatwg.org/#data-structures) recommended to describe a set of named values (key-value pairs) internally. It's not WebIDL.

[WebIDL dictionaries](https://webidl.spec.whatwg.org/#dfn-dictionary) also happen to be _"used to define an [ordered map](https://infra.spec.whatwg.org/#ordered-map) data type"_, but that doesn't make this WebIDL.

We could perhaps clarify this better in the definition of [settings dictionary](https://www.w3.org/TR/mediacapture-streams/#dfn-settings-dictionary):
```diff
- We use the term settings dictionary for the set of values that might be applied as
+ We use the term settings dictionary for the ordered map of values that might be applied as
  settings to the object.
```

> Another problem is that step 4 says If constraintValue is a boolean, but the constrainable property is not, which sounds impossible in IDL. I understand that this is intended to support pan/tilt/zoom constraints which accept boolean and numeric values. These constraints are of type (boolean or ConstraintDouble), so the constraint value is compatible with the property.

Only _constraintValue_ here is from WebIDL (coming from _CS_), and it can be either a boolean or a ConstraintDouble.

But the [constrainable property](https://www.w3.org/TR/mediacapture-streams/#types-for-constrainable-properties) is not WebIDL, and refers instead to the property being constrained by the constrainable pattern. E.g. Its type in the case of pan/tilt/zoom is [double](https://www.w3.org/TR/image-capture/#dictdef-mediasettingsrange).

-- 
GitHub Notification of comment by jan-ivar
Please view or discuss this issue at https://github.com/w3c/mediacapture-main/issues/933#issuecomment-1485054910 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 27 March 2023 12:38:04 UTC