by jedschmidt on 2/25/13, 8:33 AM with 108 comments
by jashkenas on 2/25/13, 8:44 AM
Part of the idea is that, because first and foremost you're writing a document describing what you're doing, and then filling the the implementation in the gaps ... you end up structuring the program differently than if you started out with the code was at the top level, as usual. For me, it was a fun process -- start with an outline, expand that into paragraphs below, then indent four spaces and implement each paragraph...
I'll share the full bit when I make it out of the woods next week, but for now, here's a sneak peek of a rough draft to give a flavor: http://cl.ly/N8Kx
Edit: If anyone wants a copy of the hybrid Markdown/CoffeeScript syntax highlighter (for TextMate or Sublime Text), it's available here in the "Syntaxes" folder. https://github.com/jashkenas/coffee-script-tmbundle 10,000 bonus points if you port it over to Pygments and send a pull request to GitHub ;)
by arocks on 2/25/13, 9:07 AM
If it does not it cannot be, strictly speaking, called Literate Programming: http://en.wikipedia.org/wiki/Literate_programming#Misconcept...
by crazygringo on 2/25/13, 3:43 PM
And second, the example [1] is a great model of good commenting practice -- explaining the why's, the workings, clarifying special cases. Especially with languages as concise and powerful as CoffeeScript, having as many lines of comments as lines of code, is a great balance.
It seems like such a trivial idea, comments to the left, code indented, but it's one of the best ideas I've seen pop up in a long time -- especially because it heavily nudges you to treat comments as an integral part of the file, not just an extra, and to treat the file, from the beginning, as something for others to read. Bravo!
by anonymouz on 2/25/13, 9:04 AM
by gfodor on 2/25/13, 5:04 PM
I've found that there seems to be a decent correlation with writing skills and programming skills, but that's far from a fact and I've worked with people in every spot in the 2x2 skills matrix.
by protez on 2/25/13, 11:18 AM
I just updated it to checkout .litcoffee compilation and it worked out okay. But suddenly, all my express.js apps stopped working due to the exception from its connect module. I downgraded coffee to the previous version and all things turned fine again. It seems the package needs fixes. I like most parts of node except these surprising interconnections.
by Tichy on 2/25/13, 9:00 AM
Am I missing something or is that line literally the only explanation/documentation given as to what is literate CoffeeScript and how to use it? Must admit I have no idea how to use it now.
by jahewson on 2/25/13, 11:20 AM
by quii on 2/25/13, 9:53 AM
by agentultra on 2/25/13, 2:35 PM
For that I just use babel in org-mode... but you have to be an emacs person for that. I'm sure there are other literate systems (like the original: http://www-cs-faculty.stanford.edu/~uno/cweb.html)
by franze on 2/25/13, 9:15 AM
You can now loop over an array backwards,
without having to manually deal with the indexes.
is?by arianvanp on 2/25/13, 11:44 AM
Good code documents itself and should be first-class. Comments should be there to clarify certain decisions that you've made while writing code.
Handing out citizenship to the comments just clutters the code flow and will stimulate bad commenting behaviour.
I really don't see any pros for 'executable' markdown at the moment, apart from being cool.
by jimjeffers on 2/27/13, 12:18 AM
by andyjohnson0 on 2/25/13, 12:24 PM
Has anyone (apart from Knuth) used LP for any real work of significant size? What was the justification of doing the, presumably substantial, work to add literate programming to coffescript?
by zbowling on 2/25/13, 8:41 AM
or is the code executable in the blocks in the markdown script and literate mode is a way to invoke "documentation" basically if the file is a .litcoffee document instead of a .coffee document?
by pkorzeniewski on 2/25/13, 10:08 AM
by ww520 on 2/25/13, 8:40 AM
by arvidkahl on 2/25/13, 6:36 PM
by transfire on 3/3/13, 12:36 AM
by ms123 on 2/25/13, 2:17 PM
by tbe on 2/25/13, 5:51 PM
I guess you could do this in any language by incorporating something like the following into your project's makefile:
sed '/^\t/!d; s/^\t//'
by vectorpush on 2/25/13, 7:19 PM
by nateabele on 2/25/13, 3:07 PM
I was really hoping 'literate' meant you could read the code.
by lastbookworm on 2/25/13, 10:33 PM
by namuol on 2/25/13, 10:12 AM
We all want better documentation, but the problem with comments is that they can lie.
by nathell on 2/25/13, 9:03 AM
by acedip on 2/25/13, 2:04 PM
by coldtea on 2/25/13, 11:00 AM
by camus on 2/25/13, 11:26 AM
by wildchild on 2/25/13, 10:34 AM
by Mahn on 2/25/13, 11:23 AM