__doc__ for functions, classes, objects etc.

Rick Waldron waldron.rick at gmail.com
Mon Sep 5 12:56:31 PDT 2011


In the example implementation that I created, toString() was used exclusively because it "worked" in the single environment that I tested in and gave me the minimum that I needed to produce a working proof of concept - not to show any kind of support for a better specified Function.prototype.toString()



-- Sent from my Palm Pre
On Sep 5, 2011 5:27 AM, Andreas Rossberg <rossberg at google.com> wrote: 

On 4 September 2011 21:45, Brendan Eich <brendan at mozilla.com> wrote:


On Sep 6, 2011, at 1:52 PM, Dmitry Soshnikov wrote:



> (1) to standardize `toString` (for this particular case -- do not remove comments inside);

>

> If the (1) is not possible (why by the way?),



Because comments are not saved in the compilation process and doing so would slow parsing down and take more space. It's not obvious this would matter in head-to-head competition with other browsers (esp. with minified benchmarks) -- we would have to find out.





Switching to source recovery will entrain more space but may be tolerable -- except that switching to source recovery is work, competing with other demands. There's no free lunch.



Plus, it breaks all function-based data abstraction if you can reliably reflect on its implementation and then even reify it through eval.
I am indifferent about the general idea of a doc interface, but: having to peek at the _implementation_ of something (which is what toString does) in order to gather its _interface_ description sounds like a fundamental violation of basic principles and exactly the wrong way to go about it.


/Andreas


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110905/e5a00271/attachment.html>


More information about the es-discuss mailing list