From eed5467a4f160c7d0391c268300d30aecafd6f67 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 30 Sep 2016 09:17:09 +0200 Subject: [PATCH] Remove "initializing objects from iterables" This feature was introduced by #13, but the main thing we actually needed for Headers et al was open dictionaries (see #180). As such this feature has not seen any use. --- index.bs | 38 -------------------- index.html | 102 +++++++++++------------------------------------------ 2 files changed, 20 insertions(+), 120 deletions(-) diff --git a/index.bs b/index.bs index 4e7f8c3e..56740e24 100644 --- a/index.bs +++ b/index.bs @@ -11850,44 +11850,6 @@ The value of the Function object’s “length” property is The value of the Function object’s “name” property is the String value “clear”. -

Initializing objects from iterables

- -Some objects, which are attempting to emulate map- and set-like interfaces, will want to accept iterables -as constructor parameters and initialize themselves in this way. Here we provide some algorithms that can -be invoked in order to do so in the same way as in the ECMAScript spec, so that those objects behave -the same as the built-in Map and Set objects. - -To add map elements from an iterable |iterable| to -an object |destination| with adder method name |adder|, perform the following steps: - -
    - 1. If [=Type=](|destination|) is not Object, then, throw a TypeError. - 1. If |iterable| is not present, let |iterable| be undefined. - 1. If |iterable| is either undefined or null, then let |iter| be undefined. - 1. Else, - 1. Let |adder| be the result of [=Get=](|destination|, |adder|). - 1. [=ReturnIfAbrupt=](|adder|). - 1. If [=IsCallable=](|adder|) is false, throw a TypeError. - 1. Let |iter| be the result of [=GetIterator=](|iterable|). - 1. [=ReturnIfAbrupt=](|iter|). - 1. If |iter| is undefined, then return. - 1. Repeat - 1. Let |next| be the result of [=IteratorStep=](|iter|). - 1. [=ReturnIfAbrupt=](|next|). - 1. If |next| is false, then return [=NormalCompletion=](|destination|). - 1. Let |nextItem| be [=IteratorValue=](|next|). - 1. [=ReturnIfAbrupt=](|nextItem|). - 1. If [=Type=](|nextItem|) is not Object, then throw a TypeError. - 1. Let |k| be the result of [=Get=](|nextItem|, "0"). - 1. [=ReturnIfAbrupt=](|k|). - 1. Let |v| be the result of [=Get=](|nextItem|, "1"). - 1. [=ReturnIfAbrupt=](|v|). - 1. Let |status| be the result of calling the \[[Call]] internal method of |adder| with |destination| as - |thisArgument| and (|k|, |v|) as |argumentsList|. - 1. [=ReturnIfAbrupt=](|status|). -
- -

Implements statements

The [=interface prototype object=] diff --git a/index.html b/index.html index 357c9143..d9ce4008 100644 --- a/index.html +++ b/index.html @@ -1544,7 +1544,7 @@

Web IDL

-

Editor’s Draft,

+

Editor’s Draft,

This version: @@ -1811,7 +1811,6 @@

Table of Contents

  • 3.6.11.5 add and delete
  • 3.6.11.6 clear -
  • 3.6.12 Initializing objects from iterables
  • 3.7 Implements statements
  • @@ -2432,7 +2431,7 @@

    }; node.addEventListener("click", listener); // This works. -node.addEventListener("click", function() { ... }); // As does this. +node.addEventListener("click", function() { ... }); // As does this.

    It is not possible for a user object to implement Node, however:

    var node = getNode();  // Obtain an instance of Node.
    @@ -4520,7 +4519,7 @@ 

    } // This loop will also alert "anna" and then "brian". -for (let session of sm) { +for (let session of sm) { window.alert(session.username); }

    @@ -6265,9 +6264,9 @@

    initial objects, which the following HTML document demonstrates:

    <!DOCTYPE html>
    -<title>Different global environments</title>
    -<iframe id=a></iframe>
    -<script>
    +<title>Different global environments</title>
    +<iframe id=a></iframe>
    +<script>
     var iframe = document.getElementById("a");
     var w = iframe.contentWindow;              // The global object in the frame
     
    @@ -6277,7 +6276,7 @@ 

    instanceof w.Object; // Evaluates to false iframe.appendChild instanceof Function; // Evaluates to true iframe.appendChild instanceof w.Function; // Evaluates to false -</script> +</script>

  • Unless otherwise specified, each ECMAScript global environment exposes all interfaces that the implementation supports. If a given ECMAScript global environment does not @@ -8018,7 +8017,7 @@

    .mozIndexedDB || window.msIndexedDB; var requestAnimationFrame = window.requestAnimationFrame || - window.mozRequestAnimationFrame || ...; + window.mozRequestAnimationFrame || ...;

    Because of the way variable declarations are handled in ECMAScript, the code above would result in the window.indexedDB and window.requestAnimationFrame evaluating @@ -8105,28 +8104,28 @@

    <!DOCTYPE html> -<title>Variable declarations and assignments on Window</title> -<iframe name=abc></iframe> +<title>Variable declarations and assignments on Window</title> +<iframe name=abc></iframe> <!-- Shadowing named properties --> -<script> +<script> window.abc; // Evaluates to the iframe’s Window object. abc = 1; // Shadows the named property. window.abc; // Evaluates to 1. -</script> +</script> <!-- Preserving properties for IDL attributes --> -<script> +<script> Window.prototype.def = 2; // Places a property on the prototype. window.hasOwnProperty("length"); // Evaluates to true. length; // Evaluates to 1. def; // Evaluates to 2. -</script> -<script> +</script> +<script> var length; // Variable declaration leaves existing property. length; // Evaluates to 1. var def; // Variable declaration creates shadowing property. def; // Evaluates to undefined. -</script> +</script>

    3.3.6. [LegacyArrayClass]

    @@ -11143,65 +11142,6 @@

    The value of the Function object’s “length” property is the Number value 0.

    The value of the Function object’s “name” property is the String value “clear”.

    -

    3.6.12. Initializing objects from iterables

    -

    Some objects, which are attempting to emulate map- and set-like interfaces, will want to accept iterables -as constructor parameters and initialize themselves in this way. Here we provide some algorithms that can -be invoked in order to do so in the same way as in the ECMAScript spec, so that those objects behave -the same as the built-in Map and Set objects.

    -

    To add map elements from an iterable iterable to -an object destination with adder method name adder, perform the following steps:

    -
      -
    1. -

      If Type(destination) is not Object, then, throw a TypeError.

      -
    2. -

      If iterable is not present, let iterable be undefined.

      -
    3. -

      If iterable is either undefined or null, then let iter be undefined.

      -
    4. -

      Else,

      -
        -
      1. -

        Let adder be the result of Get(destination, adder).

        -
      2. -

        ReturnIfAbrupt(adder).

        -
      3. -

        If IsCallable(adder) is false, throw a TypeError.

        -
      4. -

        Let iter be the result of GetIterator(iterable).

        -
      5. -

        ReturnIfAbrupt(iter).

        -
      -
    5. -

      If iter is undefined, then return.

      -
    6. -

      Repeat

      -
        -
      1. -

        Let next be the result of IteratorStep(iter).

        -
      2. -

        ReturnIfAbrupt(next).

        -
      3. -

        If next is false, then return NormalCompletion(destination).

        -
      4. -

        Let nextItem be IteratorValue(next).

        -
      5. -

        ReturnIfAbrupt(nextItem).

        -
      6. -

        If Type(nextItem) is not Object, then throw a TypeError.

        -
      7. -

        Let k be the result of Get(nextItem, "0").

        -
      8. -

        ReturnIfAbrupt(k).

        -
      9. -

        Let v be the result of Get(nextItem, "1").

        -
      10. -

        ReturnIfAbrupt(v).

        -
      11. -

        Let status be the result of calling the [[Call]] internal method of adder with destination as thisArgument and (k, v) as argumentsList.

        -
      12. -

        ReturnIfAbrupt(status).

        -
      -

    3.7. Implements statements

    The interface prototype object of an interface A must have a copy of each property that corresponds to one of the constants, attributes, operations, iterable declarations, maplike declarations and setlike declarations that exist on all of the interface prototype objects of A’s consequential interfaces. @@ -11317,10 +11257,10 @@

    Platform objects implementing an interface that supports indexed or named properties cannot be fixed; if Object.freeze, Object.seal or Object.preventExtensions is called on one of these objects, the function -must throw a TypeError. +must throw a TypeError. Similarly, an interface prototype object that exposes named properties due to the use of [Global] or [PrimaryGlobal] -also must throw a TypeError if one of the three functions above is called on it.

    +also must throw a TypeError if one of the three functions above is called on it.

    The name of each property that appears to exist due to an object supporting indexed properties is an array index property name, which is a property name P such that Type(P) is String @@ -12637,7 +12577,6 @@

  • ABORT_ERR, in §2.5.1
  • AbortError, in §2.5.1 -
  • add map elements from an iterable, in §3.6.12
  • any, in §2.11
  • ArrayBuffer, in §2.11.30
  • ArrayBufferView, in §4 @@ -13097,7 +13036,7 @@

    N
    [RFC3629]
    F. Yergeau. UTF-8, a transformation format of ISO 10646. November 2003. Internet Standard. URL: https://tools.ietf.org/html/rfc3629
    [SECURE-CONTEXTS] -
    Mike West. Secure Contexts. 15 September 2016. CR. URL: https://w3c.github.io/webappsec-secure-contexts/ +
    Mike West. Secure Contexts. 19 July 2016. WD. URL: https://w3c.github.io/webappsec-secure-contexts/
    [UNICODE]
    The Unicode Standard. URL: http://www.unicode.org/versions/latest/ @@ -15231,8 +15170,7 @@

    I
  • 3.6.11.1. size
  • 3.6.11.4. has
  • 3.6.11.5. add and delete -
  • 3.6.12. Initializing objects from iterables (2) (3) -
  • 3.8.1. Indexed and named properties (2) +
  • 3.8.1. Indexed and named properties (2)