Den 2013-05-28 17:37:13 skrev Ehsan Akhgari <ehsan.akhgari@gmail.com>: > Hi all, > > Consider the following code: > > var node = SomeAudioNode(); > node.channelCount = 5000000000; > > Currently, according to the spec, channelCount is an unsigned long, > which means that a Web IDL conforming implementation must convert >the > value being passed in to a 32-bit unsigned integer using the algorithm > in [1], which is basically using the modulo operation. > > This means that the implementation of the channelCount setter will see a > value which is sort of unexpected -- definitely not what the >author > wants. > > I think it makes sense for us to go through the spec and use either > [Clamp] [2] or [EnforceRange] [3] on our unsigned long and >similar > numeric types. I prefer [EnforceRange] myself because I think > exceptions are better than silently clamping these values. > > What do others think? +1 for [EnforceRange] (unless someone can think of a good reason for clamping some values). Enforcing is at least better than modulo operations. /Marcus > > > [1] http://www.w3.org/TR/WebIDL/#es-unsigned-long > [2] http://www.w3.org/TR/WebIDL/#Clamp > [3] http://www.w3.org/TR/WebIDL/#EnforceRange > > -- > Ehsan > <http://ehsanakhgari.org/> -- Marcus Geelnard Technical Lead, Mobile Infrastructure Opera SoftwareReceived on Wednesday, 29 May 2013 08:08:22 UTC
This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:03:18 UTC