[erlang-questions] Speaking of comments

Raimo Niskanen <>
Mon Dec 13 15:56:24 CET 2010


On Mon, Dec 13, 2010 at 02:04:36PM +0530, Banibrata Dutta wrote:
> On Wed, Dec 8, 2010 at 8:45 PM, Edmond Begumisa <
> > wrote:
> 
> > I've thought -- now and then, in the back of my mind -- about removing
> > comments from actual source all-together (for all languages) and instead,
> > putting them in companion files that the editor lines up side-by-side. More
> > like annotating than just traditional commenting.
> >
> >
> It's an interesting thought, as it removes clutter -- especially so for a
> programmer who is already well versed with the code.
> Most modern editors have features allowing the view to show all comments
> collapsed, expanded, and some even done so selectively.
> 
> 
> > Has this sort of thing been done before? Is there a particular editor that
> > can give me this out of the box? (I admittedly haven't explored a large
> > number of editors)
> >
> > Using Erlang as an example, I've secretly wanted something like...
> >
> > foo.erl
> > foo.cts
> >

Many moons ago at Ericsson there was a hiearchical editor named Exco used.
Its concept was that you write your code as a specification where each
heading could be expanded into sub-headings, and at the leaf level
was the source code. Then you pre-processed your Exco document to
extract the leaf level, to compile.

While editing you expanded/compressed headlines (highlited)
with simple keystrokes.

This was in the 24x80 VAX and early Unix days, so side-by-side
panels would have been futile, and color coding was green only.

It would nevertheless be another possibility for your editor suggestion.
Preprocess the readable document to get the source code. You could even
use a specialized comment style in .erl files to get a .erl file that
displays fine in your special editor yet is readable by itself.

> 
> Challenge would be to ensure 100% (fail-proof) lock-step update of the .erl
> and .cts files in VCS... ideally triggered from a single command.
> 
> 
> > Then an editor that could give me two panes while keeping the two files in
> > sync...
> >
> > foo ->  | This function does...
> >  blah  |   This part is buggy...
> >  balh  |
> >
> > Also, in the right pane, I've wanted nestable trees with flexible levels of
> > detail. Heck, why not even rich text? "FIX ME" in bold red. Take it further:
> > login-name awareness, source-control/bug-tracker integration (this
> > programmer said this, that programmer said that.)
> >
> > It seems a shame that in 2010, it's still so limiting what we can do with
> > comments in our source code!
> >
> > - Edmond -
> >
> > On Thu, 09 Dec 2010 01:39:42 +1100, David Mercer <>
> > wrote:
> >
> >  On Tuesday, December 07, 2010, Richard O'Keefe wrote:
> >>
> >>  Nesting comments are one of those clever ideas
> >>> that turn out to be really dumb, because they don't actually work.
> >>>
> >>
> >> I'll bite, mainly because I've sometimes thought nesting comments would be
> >> helpful, for instance, when commenting out large blocks of code, but it is
> >> rare that I get to work with a language that supports them.  Since you're
> >> almost always right about such things, why do you say that they don't
> >> actually work?
> >>
> >> Cheers,
> >>
> >> David
> >>
> >>
> >>

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB


More information about the erlang-questions mailing list