Re: [heycam/webidl] Clarifications to dictionary semantics (#859)

marcoscaceres commented on this pull request.



> @@ -4741,9 +4740,15 @@ where [=map/keys=] are strings and [=map/values=] are of a particular type speci
     };
 </pre>
 
-Dictionaries are always passed by value.  In language bindings where a dictionary is represented by an object of some kind, passing a
-dictionary to a [=platform object=] will not result in a reference to the dictionary being kept by that object.
-Similarly, any dictionary returned from a platform object will be a copy and modifications made to it will not be visible to the platform object.
+Dictionaries are always passed by value: the dictionary does not retain a reference to its
+language-specific representation (e.g., the corresponding ECMAScript object). So for example,
+returning a dictionary from an [=operation=] will result in a new ECMAScript object being created

I don't think the returning part is what should be clarified, as returning dictionaries is rare... it's more the passing in a dictionary in from JS to a method that is "deeply copied" (passed by value) that should be clarified... most JS programmers won't know what "passed by value" means, but it's second nature to all c++ and Rust programmers. 

-- 
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/859#pullrequestreview-379170845

Received on Monday, 23 March 2020 07:04:33 UTC