__doc__ for functions, classes, objects etc.

Andreas Rossberg rossberg at google.com
Mon Sep 5 02:26:49 PDT 2011


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/fb5a3723/attachment.html>


More information about the es-discuss mailing list