top | item 23925206

(no title)

sid- | 5 years ago

Cool idea...I would be more interested in auto-documentation tool based on this.

discuss

order

qayxc|5 years ago

That'd be truly remarkable as in actual magic.

Take this rather simple example:

  PointList interpolate(PointList sample_points, OrderedRealNumberList points_to_interpolate);
This function can be auto-documented from its name and the names and types of its arguments alone. No ML required - simple pattern matching and LUTs will do. But then again, do you really need a detailed documentation in such case?

Where a documentation would actually be helpful are cases like this:

  SUBROUTINE PCHFE (N, X, F, D, INCFD, SKIP, NE, XE, FE, IERR)
A format commonly found in the FORTRAN code of numeric libraries. If the author(s) didn't document this, an AI wouldn't stand a chance to know what it does.

PCHFE is Piecewise Cubic-Hermite Function Evaluation of course [1] and the parameters aren't exactly self-explanatory either...

[1] http://www.netlib.org/slatec/pchip/pchfe.f

bdavis__|5 years ago

Guessing !! N,X, and F are probably related to NE,XE, and FE "E" means "error"? Maybe. IERR is an error flag. Idiomatic fortran there.

Each of those variables will be defined later on, in the code. at least with a type (not required, but it is not 1960 anymore). In that declaration is where some comments would be.

          REAL*8 N ! Radius of the body in radians
Point being that fortran is not hopelessly opaque. A subroutine declaration is backed up with some more information.

(now if "implicit none" is not a requirement, then this all you get)

Love seeing some hard core numeric code. Precise and compact. No pointers, nothing sophisticated. Do loops, if statements, subroutine calls.