Coffeehouse Thread

7 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Rich text source files.

Back to Forum: Coffeehouse
  • User profile image

    Why are we still stuck with using plain vanilla (albeit Unicode) text as source files?
    What if I want to include tables in my comments, underline something, put something else in bold or even highlight a paragraph and change the color? Or maybe put an expainatory picture in there? Or a hyperlink? And while I'm at it - save the whole thing as XML instead of a text file?

    Or maybe I can, I just don't know about it?

    There has been much discussion over the years
    about how to document code. And how to keep code
    and documentation in sync. Javadoc and XML comments
    are a step in the right direction. And nowadays
    we've got syntax color coding to help us in our
    daily work. I think it would rock if I didn't have to have one set of source files, and one set of Word-files for documenation.

    Ofcourse there is a very real risk of vendor or format lock-in. But let's assume for a second that everyone gets along and uses XML, RTF or something when saving the files. Couldn't this be both convenient and increase productivity?

  • User profile image

    I think this is a really good idea.  I cant tell you how many times a picture would have been a much better comment than text alone could provide. 

    I dont think there is any reason to change the compilers though, you just need an IDE that will strip out the non-code stuff before it sends it to the compiler.  Maybe someone (you?) should fork one of the open source C# IDE's and add this feature.

  • User profile image

    lars wrote:
    save the whole thing as XML instead of a text file?

    Oh dear..

  • User profile image

    Yes! Here's a few thoughts I had on this a while ago

    This whole idea is also in-line with what Knuth proposed a long time ago with "Literate Programming", see

  • User profile image

    Thats why I like the idea of style sheets:

    No need to explain further about seperation of code and independent developer visual preferences.

  • User profile image

    Darn, Knuth is always one step ahead. Smiley

    I like the CSS idea too. I could actually end the whole "best position of curly braces" war forever. And everyone is a winner.

  • User profile image

    I wrote something like this a few years back when I was using Eiffel. I needed a way of printing my code and I hacked together a syntax highlighter which read in its bits and pieces from an XML based definition file for the language and made it all pretty...

    I worked out you only really need 2 rules for highlighting, which could be elaborated upon for positional info too Smiley

    1st rule: Highlight key words. void, public etc.

    2nd rule: Highlight between 2 identifiers. {}, "", /* */ etc.

    There are times where languages dont use a symbolic closing identifier, so identifiers can also include a new line break (for example "//"), and a range till the end of a term, like a hexadecimal number (for example $ff3)

    For each range define color and font style (with different styles for alpha and numerics). Inside each range you can also add lists of keywords for highlighting.

    I found I could write highlighters for Eiffel, Delphi, C++, and Java using these simple rules.

    Anyone interesting in taking this somewhere? Smiley

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.