Re: [heycam/webidl] Replace serializers by toJSON and [Default] extended attribute (#323)

tobie commented on this pull request.



> +          attribute unsigned long number;
+          [Default] object toJSON();
+        };
+    </pre>
+
+    Assuming each of the attributes of <code class="idl">Transaction</code> is backed by an associated value,
+    so that each [=attribute getter=] returns the corresponding associated value,
+    then the “toJSON” [=regular operation=] could be defined as follows:
+
+    <blockquote>
+        <div algorithm="example tojson">
+
+            The “toJSON” operation of the <code class="idl">Transaction</code> interface
+            must follow these steps:
+
+            1.  Let |json| be a new <code class="idl">TransactionJSONValue</code> dictionary.

This screams for slots and a default behavior of slots and getters/setters.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/pull/323#pullrequestreview-24123015

Received on Tuesday, 28 February 2017 00:35:54 UTC