__doc__ for functions, classes, objects etc.

Rick Waldron waldron.rick at gmail.com
Fri Sep 2 15:56:32 PDT 2011


While we're sharing... I've also written an implementation, albiet much
simpler in form then Dmitry's or Irakli's, but this will work in ES today as
is, using old-time multi-line and single line comments.


https://gist.github.com/1160879


Rick




On Fri, Sep 2, 2011 at 6:41 PM, Brendan Eich <brendan at mozilla.com> wrote:

> On Sep 2, 2011, at 3:29 PM, Irakli Gozalishvili wrote:
>
> On Friday, 2011-09-02 at 22:28 , Brendan Eich wrote:
>
> Can you show your label hack for SpiderMonkey to es-discuss?
>
>
> Ahh sorry I did not realized I forgot to post link:
>
> https://github.com/Gozala/doc
>
>
> Cool! Permit me to cite some of your README content to help promote to
> those who did not click ;-) -- here it is:
>
> var doc = require('doc').docdoc(doc) // Prints following output:
> /*function doc(source) { ... }-----------------------------------------------Prints documentanion of the given function*/
> // You can also document your own functions:
> function compose() {
>   doc: "Returns the composition of a list of functions, where each function"
>      | "consumes the return value of the function that follows. In math"
>      | "terms, composing the functions `f()`, `g()`, and `h()` produces"
>      | "`f(g(h()))`."
>      | "Usage:"
>      | "var greet = function(name) { return 'hi: ' + name }"
>      | "var exclaim = function(statement) { return statement + '!' }"
>      | "var welcome = compose(exclaim, greet)"
>      | "welcome('moe')"
>      | "//> 'hi: moe!'"
>
>   var funcs = Array.prototype.slice.call(arguments)
>   return function composed() {
>     var args = slice.call(arguments)
>     var i = funcs.length
>     while (0 <= --i) args = [ funcs[i].apply(this, args) ]
>     return args[0]
>   }}
>
>
> /be
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110902/b7f403ca/attachment.html>


More information about the es-discuss mailing list