Self documenting runtime interfaces.
rfx, interfaces are called
r stands for rtype.
- Write code that documents itself.
- Access type metadata inside your program at runtime.
- Generate docs like JSDoc. (Future)
- Enhance IDE tooling. (Future)
- Optional runtime type checking. (Future)
It's driven by the idea originally inspired by Lisp: Code as data. We're extending this concept to type information and documentation metadata.
This provides several benefits, but importantly, it makes your code literally self-documenting, and opens up paves the way for powerful in-app developer tooling that is not available using compile-time type systems such as TypeScript. (Note: The TypeScript team is actively working on runtime type reflection, but it currently requires you to opt-in to experimental TypeScript features, and it works using the unstable
Reflect API proposal for some future ES Next).
Status - Request for Comments
The documentation features of
rfx are working today. Feel free to experiment and open an issue with your comments.
rfx is super easy to use. In place of a regular function expression or declaration, call the
rfx with a tagged template literal containing your rtype documentation. The rtype function is a curried function that will return a function that you pass your code into.
npm install --save rfx
;const add2 = rfx`// Take two values, a & b, and return the sum.add2(a: n, b: n) => Number`a + b;add2; // logs tagged description to the console.
See rtype for more info.
An online course series for application developers. Ready to jump in? Learn more.