Re: [proximity] Behavior of `distance` attribute when sensor cannot provide distance measurements? (#44)

Greetings!

As it turned out, this topic launched a lengthy discussion on the TC53 mailing list and at our March meeting. I'll attempt to summarize that discussion here, though I'll also welcome my colleagues from TC53 to chime in. 

The high-level conclusion that we reached was that we prefer using `undefined` for both situations outlined above: when the sensor is not capable of measuring a specific distance **and** when the sensor is capable of that reading but does not currently sense an object.

The rationale basically came down to these points:

- There is a strong preference among the TC39 contingent on the committee to avoid `null` as an indicator of an absent value, believing that `undefined` is more consistent with the language design.
- There was a desire to avoid special values that still satisfy the condition `typeof value === 'number'`, out of concern that anything that is a `number` might be interpreted as a valid distance reading. This lead our discussion away from using positive infinity as a special signal value.
- In the TC53 context, it is usually true that the script knows exactly what hardware it is communicating with. We would expect the documentation for individual Proximity Sensor implementations to indicate whether or not the `distance` property of the sample will ever be anything other than `undefined`.

We're also exploring parallel ways of signaling the condition where a sensor is generally capable of measuring exact distances but currently cannot for some reason. For that type of situation, we have an additional mechanism for sensor drivers to use to signal faults. But we are holding off on refining that notion for individual sensor types until a future revision.

So, that's where we landed. I'd be happy to make the connections between committees if further discussion between the groups would be helpful!

-- 
GitHub Notification of comment by andycarle
Please view or discuss this issue at https://github.com/w3c/proximity/issues/44#issuecomment-803227496 using your GitHub account


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

Received on Saturday, 20 March 2021 02:14:40 UTC