Re: ECMAScript octet representation (was: Re: Bindings spec ready for FPWD?)

Cameron McCormack:
> I was thinking that an ES4 language binding would be separate from the
> ES3 one being specified here.  I’m confident that the mapping for
> sequence<octet> in the ES3 binding can be written so as to allow an
> implementation to use a more efficient host object than an Array object.

In fact, looking at what I’ve written for the sequence<T> mapping, I
think it currently will allow that:

  3.1.12. sequence<T>

  Values passed to a host object that expects a sequence<T> must be
  objects with a length property whose value is a non-negative integer
  Number that indicates the number of elements in the sequence. Such
  objects must return the element in the sequence at position n when
  their [[Get]] internal method is invoked with n as its argument. (An
  ECMAScript Array is an object that matches this description.) When
  the host object gets an element of the sequence using the [[Get]]
  method, the returned value will first be handled according to the
  rules in this section for the type T.

  If a host object expecting a sequence<T> is passed a value which is
  not an object with a non-negative integer Number length property, a
  TypeError exception must be thrown.

  Sequences are passed by reference. If a reference to a sequence passed
  to a host object is kept (whether internally or as the value of an
  attribute), and the passed sequence is not an ECMAScript Array object,
  the kept reference must be a newly created ECMAScript Array object
  whose contents is the elements of the sequence.

WDYT?

-- 
Cameron McCormack, http://mcc.id.au/
 xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au

Received on Friday, 29 June 2007 03:39:18 UTC