(This may be a bit odd for some of us, but I wanted to pass on a novel
innovation)

The latest release of coffeescript has a new Literate "mode": if you use
the extension .litcoffee it is also treated as markdown!  This is a modern
extension to Knuth's Literate Programming:
  http://www-cs-faculty.stanford.edu/~uno/lp.html

This is likely brought about by the coffeescript docco documentation tool,
but now integrated into the coffeescript compiler.

I've been imbedding markdown in agentscript for docco use once the project
"got real".  You can see it here:

http://htmlpreview.github.com/?https://raw.github.com/backspaces/agentscript/master/docs/model.html
I wasn't sure initially, but now am entirely sold on the approach.  For one
thing it has been invaluable for discussing the project with other
programmers wishing to modify the code.

The literate coffeescript announcement is here, with links showing the
source in various formats:
 http://coffeescript.org/#literate

As odd as it may seem, I recommend use of similar stunts in all languages
that support it.  Knuth has quite a following in this area.  The idea of
markdown comments certainly has a lot of traction.

( Now back to our scheduled .. er.. programming! :)

   -- Owen

Literate CoffeeScript

Besides being used as an ordinary programming language, CoffeeScript may
also be written in "literate" mode. If you name your file with a
.litcoffee extension,
you can write it as a Markdown document — a document that also happens to
be executable CoffeeScript code. The compiler will treat any indented
blocks (Markdown's way of indicating source code) as code, and ignore the
rest as comments.

Just for kicks, a little bit of the compiler is currently implemented in
this fashion: See it as a
document<https://gist.github.com/jashkenas/3fc3c1a8b1009c00d9df>
, 
raw<https://raw.github.com/jashkenas/coffee-script/master/src/scope.litcoffee>,
and properly highlighted in a text editor <http://cl.ly/LxEu>.

I'm fairly excited about this direction for the language, and am looking
forward to writing (and more importantly, reading) more programs in this
style. As *1.5.0* is the first version of CoffeeScript that supports it,
let us know if you have any ideas for improving the feature.
============================================================
FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com

Reply via email to