W3C home > Mailing lists > Public > public-device-apis-log@w3.org > December 2016

Re: [sensors] Don't allocate response objects to avoid triggering GC

From: Tobie Langel via GitHub <sysbot+gh@w3.org>
Date: Wed, 07 Dec 2016 11:15:20 +0000
To: public-device-apis-log@w3.org
Message-ID: <issue_comment.created-265421433-1481109318-sysbot+gh@w3.org>
>> Because it doesn't help us with requirements 2) and 3) above, makes
 for more verbose code (sensor.reading.x instead of sensor.x)

> As for 2) and 3) sensor.reading.x is not any worse than sensor.x (is
 it?)

Well for both cases 2) and 3) it seems developers would essentially 
play around with reading objects, so they be doing: `reading.x` 
anyway.

> however sensor.x (y, z) would semantically mean position of the 
sensor itself, not the obtained data.

Meh. I'm sure that won't be an issue for JS devs at all. There's a 
long tradition of favoring terseness over semantic purity in JS. 
They'll feel right at home with this.

>> and makes mutable an object developers will/should think of as 
immutable.

> cannot reading be readonly?

Sure, but that still wouldn't resolve immutability issues. It's no 
longer a sensor reading if it changes over time. It's a proxy for the 
sensor values.

-- 
GitHub Notification of comment by tobie
Please view or discuss this issue at 
https://github.com/w3c/sensors/issues/153#issuecomment-265421433 using
 your GitHub account
Received on Wednesday, 7 December 2016 11:15:28 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 12:18:52 UTC