caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Brian Hurt <brian.hurt@qlogic.com>
To: Chris Hecker <checker@d6.com>
Cc: Nickolay Semyonov-Kolchin <snob@snob.spb.ru>,
	Brian Hurt <brian.hurt@qlogic.com>, <caml-list@inria.fr>
Subject: Re: [Caml-list] single-line comment request
Date: Tue, 8 Apr 2003 12:13:02 -0500 (CDT)	[thread overview]
Message-ID: <Pine.LNX.4.33.0304081154300.2225-100000@eagle.ancor.com> (raw)
In-Reply-To: <4.3.2.7.2.20030408091635.037a29b0@localhost>

On Tue, 8 Apr 2003, Chris Hecker wrote:

> 
> >Again, this extension is purely stylish.
> 
> Actually, just to fuel the fire, it's not just stylish.  Single-line 
> comments are sometimes easier to work with programmatically 

Not noticeably in my experience.

> (no need to 
> count {[()]} to see where the comment ends, 

This is only relevent if you're parsing the file.  If you are parsing the 
file, I'm assuming you have at least regular expressions, if not a full 
on lex/yacc combination.  So counting fences isn't that big of a problem.  
Vim's syntax highlighting seems to work just fine (well, except for 
*really* long comments).

> rectangular editing commands 
> can comment and uncomment blocks, 

Adding (* before the block and *) after is so difficult?

> end of line is sometimes ragged so 
> commenting out cannot be done linearly without editor macro trickery, 

Hmm.  I wouldn't have called finding the end of a line 'editor macro 
trickery'.  In vi, it's just $.  Or, from anywhere in line, hit 'A' and 
automatically append to the end of the line.  In emacs, C-E jumps you to 
the end of the line, IIRC.

> wasted characters and movement for single line comments (which I would 
> assume are the majority of comments by number, if not by lines), 

Three.  Space, asterix, close paren.  

> etc.).  Also, using camlp4 for this slows down compiles.

All of the above might be an argument for doing single-line comments
*instead of* multiline comments.  Let me just get some plutonium for the
Delorean and we can go back to 1985 and change that design decision.

Now: here's a counter argument to adding single line comments: backwards 
compatibility.  While Ocaml-3.07 may support single line comments, 
Ocaml-3.06 doesn't, and by definition never will.  So code with single 
line comments will never run on Ocaml-3.06, despite the fact that except 
for single line comments, there is no other compatibility problems.  And 
there are reasons to still be using older versions of Ocaml- Jocaml being 
one of them.

I'm not opposed to breaking backwards compatibility- I just want something 
valuable in return.

> I would assume there are lots of two-character combinations that are 
> invalid and that don't hose cpp, like "(|" which is even a bit iconographic 
> for the task, in my opinion.  Somebody better at compilers than me could 
> probably write a program to parse the .y and .l files and generate all 
> unused and invalid two-character combinations.

Or just check out page 91 of the language standard.

> 
> Hmm, I just did a quick test to check the assumption of whether single-line 
> comments are more common.  In my code, 86% of comments are single line.  In 
> the compiler bytecomp directory, 89% are single line.  Make of that what 
> you will.

Um, that it's not hard to write single-line comments without a special 
single line comment delimiter?

Brian


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  parent reply	other threads:[~2003-04-08 17:09 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-08 12:56 Nickolay Semyonov-Kolchin
2003-04-08 15:17 ` Samuel Lacas
2003-04-08 14:27   ` Nickolay Semyonov-Kolchin
2003-04-08 16:21     ` Samuel Lacas
2003-04-09 15:15   ` Thierry SALSET
2003-04-08 15:19 ` Brian Hurt
2003-04-08 14:25   ` Nickolay Semyonov-Kolchin
2003-04-08 16:08     ` Brian Hurt
2003-04-08 15:38       ` Nickolay Semyonov-Kolchin
2003-04-08 17:42         ` Brian Hurt
2003-04-08 17:31     ` Chris Hecker
2003-04-08 16:29       ` Nickolay Semyonov-Kolchin
2003-04-08 19:26         ` Basile STARYNKEVITCH
2003-04-08 20:22           ` Brian Hurt
2003-04-08 21:37             ` Michal Moskal
2003-04-08 17:13       ` Brian Hurt [this message]
2003-04-08 19:23         ` Chris Hecker
2003-04-08 18:49           ` Karl Zilles
2003-04-08 19:04           ` Brian Hurt
2003-04-08 21:57             ` Daniel Andor
2003-04-08 22:07               ` Michal Moskal
2003-04-08 22:09               ` Brian Hurt
2003-04-10  2:59                 ` cashin
2003-04-10  7:58                   ` [Caml-list] { ... } vs ( ... ) vs begin ... end Frederic van der Plancke
2003-04-08 19:42           ` [Caml-list] single-line comment request Daniel M. Albro
2003-04-08 18:53             ` Alexander V. Voinov
2003-04-08 18:19               ` Nickolay Semyonov-Kolchin
2003-04-08 22:40             ` Joshua Scholar
2003-04-13 19:46             ` Andreas Rossberg
2003-04-13 22:57               ` Daniel M. Albro
2003-04-08 19:53           ` Jeff Henrikson
2003-04-08 20:31             ` Brian Hurt
2003-04-13 14:07     ` John Max Skaller
2003-04-08 15:28 ` Damien
2003-04-08 14:49   ` Nickolay Semyonov-Kolchin
2003-04-08 15:39   ` Brian Hurt
2003-04-08 15:45   ` malc
2003-04-08 15:45   ` Samuel Lacas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.33.0304081154300.2225-100000@eagle.ancor.com \
    --to=brian.hurt@qlogic.com \
    --cc=caml-list@inria.fr \
    --cc=checker@d6.com \
    --cc=snob@snob.spb.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).