RE: Block Commenting

new topic     » goto parent     » topic index » view thread      » older message » newer message

On 3 Aug 2003 at 14:45, Al Getz wrote:


> BI block commenting would be nice, but i've had block commenting
> since the year 2000 because i built it into my own 'personal'
> editor.
> 
> Here's the workaround...
> 
> One way for people to have 'block' commenting is simply to add
> that to their editor, or ask the person that wrote the editor
> they use to add it.  It's the easiest thing to add i must say,
> because all you have to do is allow the user to select a block
> of text (all editors do this i think) and then click a menu that
> inserts "--" at the start of each line selected, or optionally
> searches for the first non space character in each line and puts "--"
> right before that character.
> To remove the commenting, the user again selects the text block
> and then clicks on another menu item (Rems->Remove Rems) and
> it searches the beginning of text to remove "--" from the
> start of the lines, or optionally searches the whole line
> and removes the rems.
> 
> The above is useful for writing larger blocks of notes for the
> user of the file, or for debugging when you might want to rem
> out a larger section of code to study the effects of leaving it
> out, and works basically the same way block rems work in C.
> 
> My editor does the same thing for block indents, adding or
> removing as decisions are made to add or remove levels of
> nested code, and since most editors will want this too, why not
> add the block remming right into the editor?
> 
> >From a file parsing point of view, i'd say it would take longer
> to hunt for the ending rem char then to simply read in each line
> and know ahead of time you can allow the interp. to ignore it,
> unless maybe there was a restriction imposed that the block rems
> had to be in the very first column of the text--which would actually
> speed things up but would have that rather nasty restriction.
> 
Bach restricts the block comment to the first non-white chars on a line.
The opening block comment really should be restricted this way.
It might be useful to allow the closing block comment to be at the
end of the line, but forcing it to be at the start makes it easier to
find and read .  This also means that the parser is not slowed at
all, and makes it easier to write a colorizer for an editor -- Bach's
took under 1/2hr, while I have tried for years to handle C's  /*..*/,
so far without success.

I colorize my nested blocks differently than single line ones --
makes them stand out nicely.

Block comments can be well used as part of a documentation
generator scheme.

File documentation headers look quite different with the left side blank,
which some (me) may like.

Karl Bochert

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu