Re: [idl] ByteString

On Fri, Jun 22, 2012 at 9:31 AM, Cameron McCormack <cam@mcc.id.au> wrote:
> I forgot about it. :)  I've added it now (in the v2 document):
>
> http://dev.w3.org/2006/webapi/WebIDL/#idl-ByteString
> http://dev.w3.org/2006/webapi/WebIDL/#es-ByteString

Very cool! There's a but, however. The "x modulo 256" trick is not in
line with XMLHttpRequest, which throws for elements greater than 0xFF.
(Although there is one case where it currently does not throw,
getResponseHeader(), I kind of hope implementations are willing to
change that.)


>> I guess a potential downside is that people might misuse it in
>> contexts where it would not be appropriate and where you should use an
>> actual byte representation of sorts instead.
>
> Yes, we probably should have a warning in there.  Can you suggest some
> wording?  I'm struggling to express the cases where you want to use
> ByteString rather than a typed array of 8 bit integers.

"ByteString is only suitable for interfacing with protocols that use
bytes and strings interchangeably, such as HTTP."


-- 
Anne — Opera Software
http://annevankesteren.nl/
http://www.opera.com/

Received on Sunday, 24 June 2012 06:39:09 UTC