w3c / at-driver

AT Driver defines a protocol for introspection and remote control of assistive technology software, using a bidirectional communication channel.
https://w3c.github.io/at-driver
Other
31 stars 4 forks source link

Editorial: refactor setting name validation #63

Closed jugglinmike closed 1 year ago

jugglinmike commented 1 year ago

In describing the absence of validity, the algorithm named "setting name is invalid" was difficult to reason about. Although an algorithm designed to report on positive validity (e.g. one named "setting name is valid") would be both more traditional and easier to understand, it would also suggest inaccurate state in certain implementations. Specifically, in implementations which cannot reject unrecognized setting names, an algorithm titled "setting name is valid" would claim that any arbitrary setting name is "valid."

Refactor the algorithm to return one of three values to accurately describe the result and avoid misleading call sites.


@jkva This is the best I could come up with following our discussion in gh-54. I'm not convinced it's an improvement, though, particularly after learning that, unlike ECMAScript's enums, enum values in WebIDL are indistinguishable from strings.


Preview | Diff

lolaodelola commented 1 year ago

@jugglinmike this looks good & seth has already approved. I’ll merge once conflicts are resolved

jugglinmike commented 1 year ago

Thanks, @lolaodelola! Conflicts resolved!