📜 ⬆️ ⬇️

CoffeeScript 1.5.0 allows you to write comments in Markdown format

Today, February 25, version 1.5.0 of CoffeeScript has been released. It first introduced the basic support of the so-called "literate" or "literary" programming . The concept of competent programming was invented by Donald Knut in 1981 when developing the TeX system. Unlike the source code in the usual programming language, which includes small inclusions of comments, competent programming involves writing a text document in a natural language with code injections. Many existing systems of competent programming do not depend at all on a specific machine language.

Technically, competent programming is a macro system that allows you to create a layer of abstractions in the form of natural language phrases on top of code fragments in any programming language, actually creating executable pseudo-code. The source file is both an executable program and a document in natural language that describes it.

Strictly speaking, in CoffeeScript 1.5.0, the concept of Donald Knuth is not yet fully implemented - macro disclosure is not supported, the compiler only allows combining Markdown markup and CoffeeScript code in one file with the .litcoffee extension. Such a file can be executed as a regular script, or it can be opened in a text editor, where it will look like formatted text with code fragments. Here is a screenshot of the script written in the new style:


')
And this is how it looks on Gietgub as a Markdown document.

The syntax of the .litcoffee .litcoffee for TextMate and SublimeText can be downloaded here .

Previously, similar functionality was provided by the Docco library, the author of which, like the CoffeeScript language itself, is Jeremy Ashkenaz. It allows you to use Markdown markup in comments and displays text in the form of two columns - formatted comments and clean source code.

Source: https://habr.com/ru/post/170627/


All Articles