w3c / orientation-sensor

Orientation Sensor
https://www.w3.org/TR/orientation-sensor/
Other
12 stars 21 forks source link

Prefix coordinate system enum #56

Closed anssiko closed 6 years ago

anssiko commented 6 years ago

Fix https://github.com/w3c/accelerometer/issues/41#issuecomment-371892013


Preview | Diff

kenchris commented 6 years ago

That comment says

The enum LocalCoordinateSystem is defined in each of the motion sensor spec - it should be defined just once, and referenced from other specs.

This is just adding a namespace (not that common in other specs) and it becomes as long as the worst Java APIs :-(

Can't we move it to the Generic Sensor spec instead and keep the name?

@dontcallmedom

kenchris commented 6 years ago

Why no response on my comment? :-)

anssiko commented 6 years ago

@kenchris, the local coordinate system concept applies only to spatial sensors, and not all sensors that extend the Generic Sensor API. Enums are not web-exposed, so verbose enum names do not cause any ergonomics issues as in Java APIs.

kenchris commented 6 years ago

Well, they will be exposed in TypeScript project for intellisense :-) These will most likely be generated from Web IDL (Microsoft has work ongoing on making that happen), which means you will also spread these over your code (You add type declarations when using TS) - so yes, this might actually pose a real problem.

Though they only apply to some sensors, I don't see why they cannot be in the generic spec. They might be useful for future specs down the road. You can just add a Spatial Sensors section and maybe make it optional to implement unless you implement some of the derivative specs