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

> Last nit: there's little consistency with toJSON() vs toJSON (no parens). @domenic: LMK what your reasoning behind this is and I'll fix it.

It seems OK to me as-is. My take is that:

- It's important to use parens when declaring the steps for an operation, so that if there are arguments you can include those too (and then refer to them in the steps)
- It's generally nice to include the parens when talking about a method or operation
- It's better to not include the parens when talking about an identifier.

The remaining question then is when you say something like "the toJSON regular operation" are you using toJSON as an identifier or as a method name. I could go either way. It seems like the current state of this PR is to treat it as an identifier, which works fine for me.

---

One minor diff, but LGTM to merge otherwise. Let's do this!!

```diff
diff --git a/index.bs b/index.bs
index 24edade..b68344a 100644
--- a/index.bs
+++ b/index.bs
@@ -7922,8 +7922,8 @@ for which a [=corresponding default operation=] has been defined.
 
     In the ECMAScript language binding, there would exist a <code>toJSON()</code> method on
     <code class="idl">Animal</code>, <code class="idl">Human</code>,
-    and <code class="idl">Dog</code> objects:
-    
+    and (via inheritance) <code class="idl">Dog</code> objects:
+
     <pre highlight="js">
         // Get an instance of Human.
         var alice = getHuman();
@@ -7937,7 +7937,7 @@ for which a [=corresponding default operation=] has been defined.
         //   pet: Dog
         // }
         alice.toJSON();
-        
+
         // Evaluates to an object like this (notice how "breed" is absent,
         // as the Dog interface doesn't declare a default toJSON operation):
         //
@@ -10701,7 +10701,7 @@ The [=return type=] of the [=default toJSON operation=] must be {{object}}.
         E implements I;
     </pre>
 
-    Calling the <code>toJSON</code> method of an object
+    Calling the <code>toJSON()</code> method of an object
     implementing interface <code class="idl">A</code> defined above
     would return the following JSON object:
```

-- 
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#issuecomment-302518565

Received on Thursday, 18 May 2017 19:35:56 UTC