__doc__ for functions, classes, objects etc.

Brendan Eich brendan at mozilla.com
Fri Sep 2 16:07:57 PDT 2011

On Sep 2, 2011, at 3:55 PM, Oliver Hunt wrote:

> Function.toString isn't standardised, and I recall that in the past SM did elide dead code, multiple engines reformat code, so in general this doesnt seem reliable at a library level.  It also doesn't work for builtin functions, and I feel we'd want a solution that allows documentation for builtin functions as well.

Oh sure, Irakli is just making do with what happens to work. SpiderMonkey doesn't do source recovery, so it needs something special and the label hack Irakli found is "it" (for now!).

This thread was about standardizing something guaranteed that does not depend on toString, but we would love to have a winning library approach whose API we can standardize. Such a library could be scrappy (I hope not crappy ;-) about using "what happens to work" on particular engines and even versions.

> This shouldn't be taken as support for this idea (documentation as part of the language) as I feel that this is the type of feature i'd associate with the development environment rather than part of the language.

That's the other thing about a library approach: it doesn't need to land in language, but then the IDE may have to grow a full parser (probably good IDEs already have one).


More information about the es-discuss mailing list