* [Caml-list] single-line comment request
@ 2003-04-08 12:56 Nickolay Semyonov-Kolchin
2003-04-08 15:17 ` Samuel Lacas
` (2 more replies)
0 siblings, 3 replies; 38+ messages in thread
From: Nickolay Semyonov-Kolchin @ 2003-04-08 12:56 UTC (permalink / raw)
To: caml-list
Hi,
I really want single-line comment in Ocaml. Peter Weis (sorry, if I typed
name wrong) several time ago said that "there is no suitable character for
single line comment". Why don't use double '#'? I.e. '##'.
## Single line comment
let _ = ## Another single line comment
...
Nickolay
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 15:19 ` Brian Hurt
@ 2003-04-08 14:25 ` Nickolay Semyonov-Kolchin
2003-04-08 16:08 ` Brian Hurt
` (2 more replies)
0 siblings, 3 replies; 38+ messages in thread
From: Nickolay Semyonov-Kolchin @ 2003-04-08 14:25 UTC (permalink / raw)
To: Brian Hurt; +Cc: caml-list
On Tuesday 08 April 2003 20:19, Brian Hurt wrote:
> Personally, I don't find having to type three extra characters (space
> asterix close-paren) to end a comment to be that big of a burden. If a
> comment is long enough that three extra characters pushes it over a line
> length, then the comment is long enough to deserve it's own line. And if
> the burden of typing the three extra characters is enough that you stop
> writting (as many) comments, well, you have other problems IMHO.
>
> I am not seriously opposed to this, I just don't see the value.
>
1) This extension won't broke existing source code. Currently, we can't use
'##' anywhere in Ocaml.
2) This is programming-style extension. I.e. if you don't like don't use it.
For example, Larry Wall see no reason for multi-line comments. He argued that
single-line comments are much easier to read (See Perl6 design documents).
Again, this extension is purely stylish.
Nickolay
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
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
1 sibling, 1 reply; 38+ messages in thread
From: Nickolay Semyonov-Kolchin @ 2003-04-08 14:27 UTC (permalink / raw)
To: Samuel Lacas; +Cc: caml-list
On Tuesday 08 April 2003 20:17, Samuel Lacas wrote:
> Nickolay Semyonov-Kolchin a écrit 0.5K le Tue, Apr 08, 2003 at 05:56:05PM
> +0500: # Hi,
> #
> # I really want single-line comment in Ocaml. Peter Weis (sorry, if I
> typed # name wrong) several time ago said that "there is no suitable
> character for # single line comment". Why don't use double '#'? I.e. '##'.
> #
> # ## Single line comment
> # let _ = ## Another single line comment
> # ...
>
> Hmm, may be a "simple" camlp4 extension can cater for your need,
> though I personnally never explored camlp4 in depth...
>
> Hope this helps,
>
I have no camlp4 knowledge. If this can be implemented this way, I will be
happy. Are you sure that this can be done in Camlp4?
Nickolay
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 15:28 ` Damien
@ 2003-04-08 14:49 ` Nickolay Semyonov-Kolchin
2003-04-08 15:39 ` Brian Hurt
` (2 subsequent siblings)
3 siblings, 0 replies; 38+ messages in thread
From: Nickolay Semyonov-Kolchin @ 2003-04-08 14:49 UTC (permalink / raw)
To: Damien, caml-list
On Tuesday 08 April 2003 20:28, Damien wrote:
> On Tue, 8 Apr 2003 17:56:05 +0500 Nickolay Semyonov-Kolchin wrote:
> > Hi,
>
> hello
>
> > I really want single-line comment in Ocaml. Peter Weis (sorry, if I
> > typed name wrong) several time ago said that "there is no suitable
> > character for single line comment". Why don't use double '#'? I.e.
> > '##'. ## Single line comment
> > let _ = ## Another single line comment
> > ...
>
> maybe some emacs/vi guru could write a shortcut that [un]comment a
> single line...
> I am not used to Lisp, but I guess it shouldn't be difficult.
>
I tried that approach. This brings hell when nested comments appear.
Nickolay
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 12:56 [Caml-list] single-line comment request Nickolay Semyonov-Kolchin
@ 2003-04-08 15:17 ` Samuel Lacas
2003-04-08 14:27 ` Nickolay Semyonov-Kolchin
2003-04-09 15:15 ` Thierry SALSET
2003-04-08 15:19 ` Brian Hurt
2003-04-08 15:28 ` Damien
2 siblings, 2 replies; 38+ messages in thread
From: Samuel Lacas @ 2003-04-08 15:17 UTC (permalink / raw)
To: caml-list
Nickolay Semyonov-Kolchin a écrit 0.5K le Tue, Apr 08, 2003 at 05:56:05PM +0500:
# Hi,
#
# I really want single-line comment in Ocaml. Peter Weis (sorry, if I typed
# name wrong) several time ago said that "there is no suitable character for
# single line comment". Why don't use double '#'? I.e. '##'.
#
# ## Single line comment
# let _ = ## Another single line comment
# ...
Hmm, may be a "simple" camlp4 extension can cater for your need,
though I personnally never explored camlp4 in depth...
Hope this helps,
sL
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 12:56 [Caml-list] single-line comment request Nickolay Semyonov-Kolchin
2003-04-08 15:17 ` Samuel Lacas
@ 2003-04-08 15:19 ` Brian Hurt
2003-04-08 14:25 ` Nickolay Semyonov-Kolchin
2003-04-08 15:28 ` Damien
2 siblings, 1 reply; 38+ messages in thread
From: Brian Hurt @ 2003-04-08 15:19 UTC (permalink / raw)
To: Nickolay Semyonov-Kolchin; +Cc: caml-list
Personally, I don't find having to type three extra characters (space
asterix close-paren) to end a comment to be that big of a burden. If a
comment is long enough that three extra characters pushes it over a line
length, then the comment is long enough to deserve it's own line. And if
the burden of typing the three extra characters is enough that you stop
writting (as many) comments, well, you have other problems IMHO.
I am not seriously opposed to this, I just don't see the value.
Brian
On Tue, 8 Apr 2003, Nickolay Semyonov-Kolchin wrote:
> Hi,
>
> I really want single-line comment in Ocaml. Peter Weis (sorry, if I typed
> name wrong) several time ago said that "there is no suitable character for
> single line comment". Why don't use double '#'? I.e. '##'.
>
> ## Single line comment
> let _ = ## Another single line comment
> ...
>
> Nickolay
>
> -------------------
> 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
>
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 12:56 [Caml-list] single-line comment request Nickolay Semyonov-Kolchin
2003-04-08 15:17 ` Samuel Lacas
2003-04-08 15:19 ` Brian Hurt
@ 2003-04-08 15:28 ` Damien
2003-04-08 14:49 ` Nickolay Semyonov-Kolchin
` (3 more replies)
2 siblings, 4 replies; 38+ messages in thread
From: Damien @ 2003-04-08 15:28 UTC (permalink / raw)
To: caml-list
On Tue, 8 Apr 2003 17:56:05 +0500 Nickolay Semyonov-Kolchin wrote:
> Hi,
hello
> I really want single-line comment in Ocaml. Peter Weis (sorry, if I
> typed name wrong) several time ago said that "there is no suitable
> character for single line comment". Why don't use double '#'? I.e.
> '##'. ## Single line comment
> let _ = ## Another single line comment
> ...
maybe some emacs/vi guru could write a shortcut that [un]comment a
single line...
I am not used to Lisp, but I guess it shouldn't be difficult.
damien
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 16:08 ` Brian Hurt
@ 2003-04-08 15:38 ` Nickolay Semyonov-Kolchin
2003-04-08 17:42 ` Brian Hurt
0 siblings, 1 reply; 38+ messages in thread
From: Nickolay Semyonov-Kolchin @ 2003-04-08 15:38 UTC (permalink / raw)
To: Brian Hurt; +Cc: caml-list
On Tuesday 08 April 2003 21:08, Brian Hurt wrote:
> > >
> > > I am not seriously opposed to this, I just don't see the value.
> >
> > 1) This extension won't broke existing source code. Currently, we can't
> > use '##' anywhere in Ocaml.
>
> Yep. Checked that before posting. It does mean you can't run your ocaml
> code through the C preprocessor- although I have no clue why you'd want to
> do that.
:)
Run code through prepreprocessor, for removing '##' before running through
C-preprocessor.
>
> > 2) This is programming-style extension. I.e. if you don't like don't use
> > it.
>
> If I'm working alone, this works. If I'm working with other people, or on
> other people's code, this may not be an option.
>
Coding standards will help.
[Larry Wall flame skipped]
> > Again, this extension is purely stylish.
>
> Actually, personally I think ## is ugly, in that it looks entirely unlike
> Ocaml's current comment-start sequence of (*. At least with C++, /* and
> // are similiar *visually*.
Setup color-scheme in your favourite editor to make comments similar
*visually*.
P.S.
This moved fast from technical field to religious.
Nickolay
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
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
3 siblings, 0 replies; 38+ messages in thread
From: Brian Hurt @ 2003-04-08 15:39 UTC (permalink / raw)
To: Damien; +Cc: caml-list
On Tue, 8 Apr 2003, Damien wrote:
> On Tue, 8 Apr 2003 17:56:05 +0500 Nickolay Semyonov-Kolchin wrote:
> > Hi,
> hello
>
> > I really want single-line comment in Ocaml. Peter Weis (sorry, if I
> > typed name wrong) several time ago said that "there is no suitable
> > character for single line comment". Why don't use double '#'? I.e.
> > '##'. ## Single line comment
> > let _ = ## Another single line comment
> > ...
> maybe some emacs/vi guru could write a shortcut that [un]comment a
> single line...
> I am not used to Lisp, but I guess it shouldn't be difficult.
>
> damien
>
In vi:
:%s/##\(.*\)$/(*\1 *)/
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
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
3 siblings, 0 replies; 38+ messages in thread
From: malc @ 2003-04-08 15:45 UTC (permalink / raw)
To: Damien; +Cc: caml-list
On Tue, 8 Apr 2003, Damien wrote:
> On Tue, 8 Apr 2003 17:56:05 +0500 Nickolay Semyonov-Kolchin wrote:
> > Hi,
> hello
>
> > I really want single-line comment in Ocaml. Peter Weis (sorry, if I
> > typed name wrong) several time ago said that "there is no suitable
> > character for single line comment". Why don't use double '#'? I.e.
> > '##'. ## Single line comment
> > let _ = ## Another single line comment
> > ...
> maybe some emacs/vi guru could write a shortcut that [un]comment a
> single line...
> I am not used to Lisp, but I guess it shouldn't be difficult.
(defun caml-comment-till-end-of-line (&optional arg)
(interactive "P")
(save-excursion
(if (looking-at search-whitespace-regexp)
(re-search-forward search-whitespace-regexp))
(comment-region (point) (progn (end-of-line) (point)) arg)))
(global-set-key [(alt ?\;)] 'caml-comment-till-end-of-line)
C-; - comment
C-u C-; - reverse
--
mailto:malc@pulsesoft.com
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 15:28 ` Damien
` (2 preceding siblings ...)
2003-04-08 15:45 ` malc
@ 2003-04-08 15:45 ` Samuel Lacas
3 siblings, 0 replies; 38+ messages in thread
From: Samuel Lacas @ 2003-04-08 15:45 UTC (permalink / raw)
To: caml-list
Damien a écrit 0.7K le Tue, Apr 08, 2003 at 05:28:05PM +0200:
# maybe some emacs/vi guru could write a shortcut that [un]comment a
# single line...
# I am not used to Lisp, but I guess it shouldn't be difficult.
Well, I suppose I'm now a VIM guru :)
nmap <C-C> :s/^.*$/(* & *)/<CR>
maps (Control-C) (which is the meaning of "<C-c>") in normal mode
(thus the "nmap") to a readable regexp substitution.
This comments the whole line.
mapping another key to :s/(\* \| \*)//g<CR> uncomment the line.
If one wants to have the same key to toggle the comment/uncomment,
or comment from the cursor's position up to the end of the line,
it will cost you more...
sL
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
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:31 ` Chris Hecker
2003-04-13 14:07 ` John Max Skaller
2 siblings, 1 reply; 38+ messages in thread
From: Brian Hurt @ 2003-04-08 16:08 UTC (permalink / raw)
To: Nickolay Semyonov-Kolchin; +Cc: Brian Hurt, caml-list
On Tue, 8 Apr 2003, Nickolay Semyonov-Kolchin wrote:
> On Tuesday 08 April 2003 20:19, Brian Hurt wrote:
> > Personally, I don't find having to type three extra characters (space
> > asterix close-paren) to end a comment to be that big of a burden. If a
> > comment is long enough that three extra characters pushes it over a line
> > length, then the comment is long enough to deserve it's own line. And if
> > the burden of typing the three extra characters is enough that you stop
> > writting (as many) comments, well, you have other problems IMHO.
> >
> > I am not seriously opposed to this, I just don't see the value.
> >
>
> 1) This extension won't broke existing source code. Currently, we can't use
> '##' anywhere in Ocaml.
Yep. Checked that before posting. It does mean you can't run your ocaml
code through the C preprocessor- although I have no clue why you'd want to
do that.
>
> 2) This is programming-style extension. I.e. if you don't like don't use it.
If I'm working alone, this works. If I'm working with other people, or on
other people's code, this may not be an option.
>
> For example, Larry Wall see no reason for multi-line comments. He argued that
> single-line comments are much easier to read (See Perl6 design documents).
If we had single-line comments, and the proposal was to add multi-line
comments, I'd feel the same way.
And Larry Wall is maybe not the best person to be taking style tips from
for Ocaml. If Perl is the archtype of post-modern programming languages,
than Ocaml must the the paragon of modern programming languages ("I am the
very model of a modern language paradigm..."). And I think there are
advantages to "modern" (in the Wall sense) languages. But I am not here
to praise Larry Wall, but to bury him.
>
> Again, this extension is purely stylish.
Actually, personally I think ## is ugly, in that it looks entirely unlike
Ocaml's current comment-start sequence of (*. At least with C++, /* and
// are similiar *visually*.
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 14:27 ` Nickolay Semyonov-Kolchin
@ 2003-04-08 16:21 ` Samuel Lacas
0 siblings, 0 replies; 38+ messages in thread
From: Samuel Lacas @ 2003-04-08 16:21 UTC (permalink / raw)
To: Nickolay Semyonov-Kolchin; +Cc: caml-list
Nickolay Semyonov-Kolchin a écrit 1.0K le Tue, Apr 08, 2003 at 07:27:53PM +0500:
# I have no camlp4 knowledge. If this can be implemented this way, I will be
# happy. Are you sure that this can be done in Camlp4?
Well, after looking a little bit, I'm not sure, at least without a
significant amount of work (i.e. redefining the whole syntax, as
one-line comment may appear everywhere). After all, the caml parser
does not seem to consider newline characters differently than spaces
(true?), which could prove to be there a strong limitation. Otchien jal...
Da zvidania,
sL
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
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 17:13 ` Brian Hurt
1 sibling, 1 reply; 38+ messages in thread
From: Nickolay Semyonov-Kolchin @ 2003-04-08 16:29 UTC (permalink / raw)
To: Chris Hecker; +Cc: caml-list
On Tuesday 08 April 2003 22:31, Chris Hecker wrote:
>
> 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.
>
This is serious technical motivation to implement single-line comments in
language.
Nickolay
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 17:31 ` Chris Hecker
2003-04-08 16:29 ` Nickolay Semyonov-Kolchin
@ 2003-04-08 17:13 ` Brian Hurt
2003-04-08 19:23 ` Chris Hecker
1 sibling, 1 reply; 38+ messages in thread
From: Brian Hurt @ 2003-04-08 17:13 UTC (permalink / raw)
To: Chris Hecker; +Cc: Nickolay Semyonov-Kolchin, Brian Hurt, caml-list
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 14:25 ` Nickolay Semyonov-Kolchin
2003-04-08 16:08 ` Brian Hurt
@ 2003-04-08 17:31 ` Chris Hecker
2003-04-08 16:29 ` Nickolay Semyonov-Kolchin
2003-04-08 17:13 ` Brian Hurt
2003-04-13 14:07 ` John Max Skaller
2 siblings, 2 replies; 38+ messages in thread
From: Chris Hecker @ 2003-04-08 17:31 UTC (permalink / raw)
To: Nickolay Semyonov-Kolchin, Brian Hurt; +Cc: caml-list
>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 (no need to
count {[()]} to see where the comment ends, rectangular editing commands
can comment and uncomment blocks, end of line is sometimes ragged so
commenting out cannot be done linearly without editor macro trickery,
wasted characters and movement for single line comments (which I would
assume are the majority of comments by number, if not by lines),
etc.). Also, using camlp4 for this slows down compiles.
I don't think this is the most important feature ever, but it would be nice
for more than just stylistic reasons.
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.
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.
Chris
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 15:38 ` Nickolay Semyonov-Kolchin
@ 2003-04-08 17:42 ` Brian Hurt
0 siblings, 0 replies; 38+ messages in thread
From: Brian Hurt @ 2003-04-08 17:42 UTC (permalink / raw)
To: Nickolay Semyonov-Kolchin; +Cc: Brian Hurt, caml-list
On Tue, 8 Apr 2003, Nickolay Semyonov-Kolchin wrote:
> On Tuesday 08 April 2003 21:08, Brian Hurt wrote:
> > > >
> > > > I am not seriously opposed to this, I just don't see the value.
> > >
> > > 1) This extension won't broke existing source code. Currently, we can't
> > > use '##' anywhere in Ocaml.
> >
> > Yep. Checked that before posting. It does mean you can't run your ocaml
> > code through the C preprocessor- although I have no clue why you'd want to
> > do that.
>
> :)
> Run code through prepreprocessor, for removing '##' before running through
> C-preprocessor.
Too bad that ## is the C preprocessor token-pasting symbol. Otherwise
that'd work.
> > If I'm working alone, this works. If I'm working with other people, or on
> > other people's code, this may not be an option.
> >
>
> Coding standards will help.
Ever been on a coding standards committee? I have. Loads of fun.
Seriously, coding standards are a really good idea- when they can be
enforced. But there are lots of situations where they can't be. One
obvious example is open source.
> > Actually, personally I think ## is ugly, in that it looks entirely unlike
> > Ocaml's current comment-start sequence of (*. At least with C++, /* and
> > // are similiar *visually*.
>
> Setup color-scheme in your favourite editor to make comments similar
> *visually*.
The language architects version of planting vines. On the other hand,
this complaint can be fixed simply by changing the keystroke combination,
to say (| or (/ (the second being the obvious reference to C++'s /* and
//).
>
> P.S.
> This moved fast from technical field to religious.
>
I must have missed the technical phase of the conversation, then. :-)
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 18:53 ` Alexander V. Voinov
@ 2003-04-08 18:19 ` Nickolay Semyonov-Kolchin
0 siblings, 0 replies; 38+ messages in thread
From: Nickolay Semyonov-Kolchin @ 2003-04-08 18:19 UTC (permalink / raw)
To: Alexander V. Voinov, Daniel M. Albro; +Cc: caml-list
On Tuesday 08 April 2003 23:53, Alexander V. Voinov wrote:
> Hi All,
>
> Daniel M. Albro wrote:
> > But ## is so *ugly*! It just doesn't look OCaml-ic, since # is
> > already the object-call operator. What other possibilities are there?
> > How about %, %%, --, ' ? If "--" isn't used it might be nice.
>
> I'd vote for "--" or "%%". The need for a one-line comment is obvious
> for me. It's also a matter for quicker adoption among those who is
> practically working with Python, C++, Java etc.
>
===================================
Objective Caml version 3.06
# let (--) = (+) ;;
val ( -- ) : int -> int -> int = <fun>
# let (%%) = (+) ;;
val ( %% ) : int -> int -> int = <fun>
# let (##) = (+) ;;
Syntax error
#
====================================
We must find a sequence that can't be used as a binary operator.
P.S.
I have nothing against '--', '%%' or whatever. I just want to see easily
typed single-line comment in Ocaml.
Nickolay
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 19:23 ` Chris Hecker
@ 2003-04-08 18:49 ` Karl Zilles
2003-04-08 19:04 ` Brian Hurt
` (2 subsequent siblings)
3 siblings, 0 replies; 38+ messages in thread
From: Karl Zilles @ 2003-04-08 18:49 UTC (permalink / raw)
To: Chris Hecker; +Cc: Brian Hurt, Nickolay Semyonov-Kolchin, caml-list
Chris Hecker wrote:
> There's really no downside that I can see to supporting them besides
> minor backwards compatibility (but hey, if you want to port back, just
> write an editor macro to convert them since you argue they're so easy!
> :), using another token, and somebody has to go implement them. There
> are many minor upsides, including a bunch that haven't been listed like
> avoiding questions about this topic on the list, and matching people's
> intuition from C++, etc. It seems like a clear win to me.
I agree. Clearly this is not *needed*, but it is something I have found
myself wishing for. Something simple to type would be nice. I find
(**) to be a little acrobatic for my fingers. (I can imagine I will be
mocked for complaining about this).
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
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
2 siblings, 1 reply; 38+ messages in thread
From: Alexander V. Voinov @ 2003-04-08 18:53 UTC (permalink / raw)
To: Daniel M. Albro; +Cc: caml-list
Hi All,
Daniel M. Albro wrote:
>
> But ## is so *ugly*! It just doesn't look OCaml-ic, since # is
> already the object-call operator. What other possibilities are there?
> How about %, %%, --, ' ? If "--" isn't used it might be nice.
I'd vote for "--" or "%%". The need for a one-line comment is obvious
for me. It's also a matter for quicker adoption among those who is
practically working with Python, C++, Java etc.
Alexander
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
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 19:42 ` [Caml-list] single-line comment request Daniel M. Albro
2003-04-08 19:53 ` Jeff Henrikson
3 siblings, 1 reply; 38+ messages in thread
From: Brian Hurt @ 2003-04-08 19:04 UTC (permalink / raw)
To: Chris Hecker; +Cc: Brian Hurt, Nickolay Semyonov-Kolchin, Ocaml Mailing List
On Tue, 8 Apr 2003, Chris Hecker wrote:
>
> > > 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.
>
> Hmm, well I guess I have different experiences from you on this front.
>
> This is starting to become a "you don't need that" argument.
No, it's a "this doesn't give us anything" argument. Well, except for a)
it saves having to type three whole extra characters in single line
comments, and b) it shuts up the people who demand single-line comments.
> The backwards
> compatibility argument is the only one you've given that has any actual
> technical objectivity behind it, and it's pretty weak because almost every
> iteration of caml isn't backwards compatible (if not in core language, then
> library functions, etc.) and I want it that way and think they should
> accelerate that. Much better to get changes out of the way now than later
> when caml is more popular.
If we're going to be introducing gratuitous backwards incompatiblities,
can we please do it for something usefull? Like say replacing begin/end
with { and }. This would be incredibly usefull, allowing vi users to yank
and put whole code branchs with y% and d%. Of course, we'd need a new
syntax for structures. But hey, it's all just cosmetic changes anyways-
just use an awk script if you need to back port.
I'm half joking here, but only half.
As for having arguments with technical objectivity, I'll agree they've
been light on the ground. Backwards compatibility is the only one I've
seen/made against. Saving the three keystrokes is the only one I've
see in favor.
>
> As for editor macros and parsing, I'm familiar with my editor, thanks. The
> point is you need to write no macros when doing a lot of operations with
> single line comments, versus having to write macros to handle things as
> easily with multiline.
Bwuh? What macros do you need? Oh sorry. Yes, if you want to save those
last three keystrokes. Generally not worth the effort.
Maybe this is my problem. I'm a fast enough typer that another 2-3
characters aren't even noticed. Not to mention the fact that in my
experience programmers spend more time not typing than they do typing. So
I don't bother to macroize anything. Maybe you could give me some
examples?
> That indicates a complexity for operations that you
> don't seem to acknowledge. If you're at a different editor and don't have
> your macros, who's better off?
I program in so many different languages that I don't bother to have
special macros for any of them.
> And, the macros are nontrivial in the cases
> of mixed length code and nested comments and whatnot. A lot of operations
> are just more complicated with bracketed comments since you have to keep
> state [that standard regexs can't handle]. I don't see how you can argue
> the contrary.
So are we arguing that we should do away with (* *) comments? Because as
long as (* *) still exists in the language, you have to deal with these
problems anyways.
>
> There's really no downside that I can see to supporting them besides minor
> backwards compatibility (but hey, if you want to port back, just write an
> editor macro to convert them since you argue they're so easy! :),
Knowing the issue even exists is 99% of the problem.
> using
> another token, and somebody has to go implement them. There are many minor
> upsides, including a bunch that haven't been listed like avoiding questions
> about this topic on the list, and matching people's intuition from C++,
> etc. It seems like a clear win to me.
Ocaml is such a fundamentally radically different programming paradigm
from C++, that I don't think matching people's C++ intuitions (or Java
intuitions) is a benefit. In fact, it might even be a detriment.
Consider for a few seconds a.(i) <- 3 vr.s a[i] = 3. Or 31-bit ints, for
that matter.
FAQs are how you deal with questions to the list.
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 17:13 ` Brian Hurt
@ 2003-04-08 19:23 ` Chris Hecker
2003-04-08 18:49 ` Karl Zilles
` (3 more replies)
0 siblings, 4 replies; 38+ messages in thread
From: Chris Hecker @ 2003-04-08 19:23 UTC (permalink / raw)
To: Brian Hurt; +Cc: Nickolay Semyonov-Kolchin, Brian Hurt, caml-list
> > 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.
Hmm, well I guess I have different experiences from you on this front.
This is starting to become a "you don't need that" argument. The backwards
compatibility argument is the only one you've given that has any actual
technical objectivity behind it, and it's pretty weak because almost every
iteration of caml isn't backwards compatible (if not in core language, then
library functions, etc.) and I want it that way and think they should
accelerate that. Much better to get changes out of the way now than later
when caml is more popular.
As for editor macros and parsing, I'm familiar with my editor, thanks. The
point is you need to write no macros when doing a lot of operations with
single line comments, versus having to write macros to handle things as
easily with multiline. That indicates a complexity for operations that you
don't seem to acknowledge. If you're at a different editor and don't have
your macros, who's better off? And, the macros are nontrivial in the cases
of mixed length code and nested comments and whatnot. A lot of operations
are just more complicated with bracketed comments since you have to keep
state [that standard regexs can't handle]. I don't see how you can argue
the contrary.
There's really no downside that I can see to supporting them besides minor
backwards compatibility (but hey, if you want to port back, just write an
editor macro to convert them since you argue they're so easy! :), using
another token, and somebody has to go implement them. There are many minor
upsides, including a bunch that haven't been listed like avoiding questions
about this topic on the list, and matching people's intuition from C++,
etc. It seems like a clear win to me.
Chris
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 16:29 ` Nickolay Semyonov-Kolchin
@ 2003-04-08 19:26 ` Basile STARYNKEVITCH
2003-04-08 20:22 ` Brian Hurt
0 siblings, 1 reply; 38+ messages in thread
From: Basile STARYNKEVITCH @ 2003-04-08 19:26 UTC (permalink / raw)
To: caml-list
>>>>> "Nickolay" == Nickolay Semyonov-Kolchin <snob@snob.spb.ru> writes:
Nickolay> On Tuesday 08 April 2003 22:31, Chris Hecker wrote:
Chris>> Hmm, I just did a quick test to check the assumption of
Chris>> whether single-line comments are more common. In my code, 86%
Chris>> of comments are single line. [...]
I also have many single line comments
Nickolay> This is serious technical motivation to implement
Nickolay> single-line comments in language.
I agree, but will make a few remarks:
adding single-line comment is trivial to do; for example, to add ##
comments just add the following UNTESTED line to ocaml/lex/lexer.mll
(after rule main = parse near line 90)
"##" [ ^ '\n' '\r' ] + { main lexbuf }
the problem is to agree for a lexing comment rule which won't break a
lot of existing code. I have no idea if ## is not already used in some
existing code somewhere. (And it is not definable as an infix
operator). Of course, the problem is to avoid clashes with practical
use of the infix operator syntax in Ocaml.
perhaps we might agree on a triple character comment starter if a
double character is not enough.
Egoistically, as a user of a French AZERTY keyboard, I tend to dislike
the # char since it require a double-keystroke (# is AltGr " on AZERTY
keyboards).
I also suggest the following di-graph for comments
## as suggested before
#! (which is compatible with Unix first line execve convention)
-- (which is like comments in Ada and Haskell)
// (reminding of Java & C++)
%%
|* for the visual effect
!! (old Basic had single ! for comment)
For tri-graph starting line comments we could consider
---
***
|||
///
-*-
[*]
I'm sorry for this posting (which is a bit silly or at least
unimportant, as the whole thread). The major point is to reach an
agreement; once we've got an agreement which don't break a lot of code
implementing such one-line comments is a matter of minutes. (Of
course, extending the Emacs & Vim mode for emacs is a bit harder).
Regards.
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 19:23 ` Chris Hecker
2003-04-08 18:49 ` Karl Zilles
2003-04-08 19:04 ` Brian Hurt
@ 2003-04-08 19:42 ` Daniel M. Albro
2003-04-08 18:53 ` Alexander V. Voinov
` (2 more replies)
2003-04-08 19:53 ` Jeff Henrikson
3 siblings, 3 replies; 38+ messages in thread
From: Daniel M. Albro @ 2003-04-08 19:42 UTC (permalink / raw)
To: caml-list
But ## is so *ugly*! It just doesn't look OCaml-ic, since # is
already the object-call operator. What other possibilities are there?
How about %, %%, --, ' ? If "--" isn't used it might be nice.
Chris Hecker wrote:
>
>> > 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.
>
>
> Hmm, well I guess I have different experiences from you on this front.
>
> This is starting to become a "you don't need that" argument. The
> backwards compatibility argument is the only one you've given that has
> any actual technical objectivity behind it, and it's pretty weak because
> almost every iteration of caml isn't backwards compatible (if not in
> core language, then library functions, etc.) and I want it that way and
> think they should accelerate that. Much better to get changes out of
> the way now than later when caml is more popular.
>
> As for editor macros and parsing, I'm familiar with my editor, thanks.
> The point is you need to write no macros when doing a lot of operations
> with single line comments, versus having to write macros to handle
> things as easily with multiline. That indicates a complexity for
> operations that you don't seem to acknowledge. If you're at a different
> editor and don't have your macros, who's better off? And, the macros
> are nontrivial in the cases of mixed length code and nested comments and
> whatnot. A lot of operations are just more complicated with bracketed
> comments since you have to keep state [that standard regexs can't
> handle]. I don't see how you can argue the contrary.
>
> There's really no downside that I can see to supporting them besides
> minor backwards compatibility (but hey, if you want to port back, just
> write an editor macro to convert them since you argue they're so easy!
> :), using another token, and somebody has to go implement them. There
> are many minor upsides, including a bunch that haven't been listed like
> avoiding questions about this topic on the list, and matching people's
> intuition from C++, etc. It seems like a clear win to me.
>
> Chris
>
>
> -------------------
> 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
>
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 19:23 ` Chris Hecker
` (2 preceding siblings ...)
2003-04-08 19:42 ` [Caml-list] single-line comment request Daniel M. Albro
@ 2003-04-08 19:53 ` Jeff Henrikson
2003-04-08 20:31 ` Brian Hurt
3 siblings, 1 reply; 38+ messages in thread
From: Jeff Henrikson @ 2003-04-08 19:53 UTC (permalink / raw)
To: caml-list; +Cc: Nickolay Semyonov-Kolchin
Though I favor the addition of the single line comments, most of the
comments thus far seem to be very subjective. I find the "80+ percent
of comments in the existing sources are single line comment" fairly
weighty. I also find the following unmentioned idea significant:
single line comments save large number of keystrokes when substituting
different chunks of code during testing. Also adding printfs. And any
comment-compile-uncomment-compile situation. It's a fairly specific
task, but also a pronounced difference when it happens.
I find a lot of the "no-single-comment" arguments to be sounding
remarkably reductionist in the way the "we don't need GUI" arguments
that certain die hard UNIX users purvey. The comment character is a
user interface for a programming language. Let's make it a nice one.
OCaml already breaks backward compatibility often. And for whatever
branches of OCaml are out there, any backport would be trivial.
BTW, I kind of don't like ##, because it's a shift key. There are no
single char symbols left, okay. But that's true for C(++) as well,
hence the "//". What's wrong with //? I see that it's an "operator
char" in the language definition lexical conventions. I'm not sure if
that's a big deal. I'd like "--" also. Same op-ch issue.
Jeff Henrikson
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 19:26 ` Basile STARYNKEVITCH
@ 2003-04-08 20:22 ` Brian Hurt
2003-04-08 21:37 ` Michal Moskal
0 siblings, 1 reply; 38+ messages in thread
From: Brian Hurt @ 2003-04-08 20:22 UTC (permalink / raw)
To: Basile STARYNKEVITCH; +Cc: caml-list
On Tue, 8 Apr 2003, Basile STARYNKEVITCH wrote:
> I also suggest the following di-graph for comments
> #! (which is compatible with Unix first line execve convention)
Aha! OK- here is a really good reason to add single line comments, with
#! as the comment delimiter- so we can put
#!/usr/local/bin/ocaml
as the first line in our programs, and have Ocaml as an interpreted
scripting language, as well as a interpreter/bytecode/native language.
Congratulations. This is by far the best argument I've seen put forth so
far. So much so that it's actually changed my mind to be in favor of the
proposal.
> -- (which is like comments in Ada and Haskell)
> // (reminding of Java & C++)
> %%
> |* for the visual effect
> !! (old Basic had single ! for comment)
>
> For tri-graph starting line comments we could consider
> ---
> ***
> |||
> ///
> -*-
All of the above are valid operator names. Not sure about [*]. See page
91 of the language standard.
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 19:53 ` Jeff Henrikson
@ 2003-04-08 20:31 ` Brian Hurt
0 siblings, 0 replies; 38+ messages in thread
From: Brian Hurt @ 2003-04-08 20:31 UTC (permalink / raw)
To: Jeff Henrikson; +Cc: caml-list, Nickolay Semyonov-Kolchin
On Tue, 8 Apr 2003, Jeff Henrikson wrote:
> Though I favor the addition of the single line comments, most of the
> comments thus far seem to be very subjective. I find the "80+ percent
> of comments in the existing sources are single line comment" fairly
> weighty. I also find the following unmentioned idea significant:
> single line comments save large number of keystrokes when substituting
> different chunks of code during testing. Also adding printfs. And any
> comment-compile-uncomment-compile situation. It's a fairly specific
> task, but also a pronounced difference when it happens.
Actually, I was about to use this as an argument for why multi-line
comments are better. I do this a lot- comment out huge swaths of code,
and then uncomment it one function at a time. I do this by moving the (*
around. Very fast. Very simple. Simply dd on the line with the (*, page
or arrow down to the next break point, and do a p.
>
> I find a lot of the "no-single-comment" arguments to be sounding
> remarkably reductionist in the way the "we don't need GUI" arguments
> that certain die hard UNIX users purvey.
Oh don't be silly. Of course we need a GUI- so we can multiple xterms on
the same screen! :-)
A more legitimate analogy would be not needing both a mouse and a
trackball. You know- some people prefer mice, and others track balls, and
sometimes it's more easy to use one than the other, so we really need
both.
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 20:22 ` Brian Hurt
@ 2003-04-08 21:37 ` Michal Moskal
0 siblings, 0 replies; 38+ messages in thread
From: Michal Moskal @ 2003-04-08 21:37 UTC (permalink / raw)
To: Brian Hurt; +Cc: Basile STARYNKEVITCH, caml-list
On Tue, Apr 08, 2003 at 03:22:59PM -0500, Brian Hurt wrote:
> On Tue, 8 Apr 2003, Basile STARYNKEVITCH wrote:
>
> > I also suggest the following di-graph for comments
> > #! (which is compatible with Unix first line execve convention)
>
> Aha! OK- here is a really good reason to add single line comments, with
> #! as the comment delimiter- so we can put
> #!/usr/local/bin/ocaml
> as the first line in our programs, and have Ocaml as an interpreted
> scripting language, as well as a interpreter/bytecode/native language.
ocaml (as opposed to ocamlc) recognizes this as comment, but only at the
first line of a file.
> All of the above are valid operator names. Not sure about [*]. See page
> 91 of the language standard.
Neither [*] nor #! are accepted by ocamlc as operator names.
I personally would find single line comments useful for turning various
debugging (single line) calls on/off, e.g.:
f ();
(* dbg "f done"; *)
let i = g () in
dbg "g done, %d" i;
h ()
But I don't care much, just need to write vim macro :-)
--
: Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv
: PLD Linux ::::::::: Wroclaw University, CS Dept : {E-,w}-- {b++,e}>+++ h
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
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
0 siblings, 2 replies; 38+ messages in thread
From: Daniel Andor @ 2003-04-08 21:57 UTC (permalink / raw)
To: Ocaml Mailing List
On Tuesday 08 April 2003 8:04 pm, Brian Hurt wrote:
> If we're going to be introducing gratuitous backwards incompatiblities,
> can we please do it for something usefull? Like say replacing begin/end
> with { and }.
If I may be a beginner here: how does "begin ... end" differ from "( ... )"?
In practice I've found them to be interchangable, but that could just be an
accident.
Daniel.
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 21:57 ` Daniel Andor
@ 2003-04-08 22:07 ` Michal Moskal
2003-04-08 22:09 ` Brian Hurt
1 sibling, 0 replies; 38+ messages in thread
From: Michal Moskal @ 2003-04-08 22:07 UTC (permalink / raw)
To: Daniel Andor; +Cc: Ocaml Mailing List
On Tue, Apr 08, 2003 at 10:57:11PM +0100, Daniel Andor wrote:
> On Tuesday 08 April 2003 8:04 pm, Brian Hurt wrote:
> > If we're going to be introducing gratuitous backwards incompatiblities,
> > can we please do it for something usefull? Like say replacing begin/end
> > with { and }.
>
> If I may be a beginner here: how does "begin ... end" differ from "( ... )"?
> In practice I've found them to be interchangable, but that could just be an
> accident.
No accident, they are just the same. It's matter of personal taste to
use one or another. begin ... end is used mainly in imperative contexts.
--
: Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv
: PLD Linux ::::::::: Wroclaw University, CS Dept : {E-,w}-- {b++,e}>+++ h
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
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
1 sibling, 1 reply; 38+ messages in thread
From: Brian Hurt @ 2003-04-08 22:09 UTC (permalink / raw)
To: Daniel Andor; +Cc: Ocaml Mailing List
On Tue, 8 Apr 2003, Daniel Andor wrote:
> On Tuesday 08 April 2003 8:04 pm, Brian Hurt wrote:
> > If we're going to be introducing gratuitous backwards incompatiblities,
> > can we please do it for something usefull? Like say replacing begin/end
> > with { and }.
>
> If I may be a beginner here: how does "begin ... end" differ from "( ... )"?
> In practice I've found them to be interchangable, but that could just be an
> accident.
At the linguistic level, not at all. At the text editor level, it's
easier in vi to jump to match braces than matching begin/ends.
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
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 22:40 ` Joshua Scholar
2003-04-13 19:46 ` Andreas Rossberg
2 siblings, 0 replies; 38+ messages in thread
From: Joshua Scholar @ 2003-04-08 22:40 UTC (permalink / raw)
To: caml-list
----- Original Message -----
From: "Daniel M. Albro" <albro@humnet.ucla.edu>
To: <caml-list@inria.fr>
Sent: Tuesday, April 08, 2003 12:42 PM
Subject: Re: [Caml-list] single-line comment request
>
> But ## is so *ugly*!
Oh, you want pretty. How about emoticon comments, for instance:
(;
[look it's smiling and winking at you!]
or (:
You could have different emoticons for different kinds of commments for
instance:
^_^
^_-
^o^
-_-
>_<
Here's a list of ascii emoticons from Japan that you can use for inspiration
http://club.pep.ne.jp/%7Ehiroette/en/facemarks/list_index.html
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 15:17 ` Samuel Lacas
2003-04-08 14:27 ` Nickolay Semyonov-Kolchin
@ 2003-04-09 15:15 ` Thierry SALSET
1 sibling, 0 replies; 38+ messages in thread
From: Thierry SALSET @ 2003-04-09 15:15 UTC (permalink / raw)
To: Samuel.Lacas; +Cc: caml-list
[-- Attachment #1: Type: Text/Plain, Size: 875 bytes --]
>>>>> "Samuel" == Samuel Lacas <Samuel.Lacas@trusted-logic.fr> writes:
Samuel> Nickolay Semyonov-Kolchin a écrit 0.5K le Tue, Apr 08, 2003
Samuel> at 05:56:05PM +0500: Hi, I really want single-line comment
Samuel> in Ocaml. Peter Weis (sorry, if I typed name wrong) several
Samuel> time ago said that "there is no suitable character for
Samuel> single line comment". Why don't use double '#'? I.e. '##'.
Samuel> Single line comment let _ = ## Another single line comment
Samuel> ...
Samuel> Hmm, may be a "simple" camlp4 extension can cater for your
Samuel> need, though I personnally never explored camlp4 in depth...
Comments are processed by the lexer, so a simple extension to the camlp4
lexer should allow that. A patch to camlp4/lib/plexer.ml (O'Caml 3.06)
follows.
Thierry Salset
CERMICS / ENPC
[-- Attachment #2: plexer.diff --]
[-- Type: Text/Plain, Size: 1363 bytes --]
*** camlp4/lib/plexer.ml Fri Jul 19 16:53:48 2002
--- camlp4/lib/patched/plexer.ml Wed Apr 9 17:10:26 2003
***************
*** 127,133 ****
[ [: `' ' | '\010' | '\013' | '\t' | '\026' | '\012'; s :] ->
next_token s
| [: `'('; s :] -> left_paren bp s
! | [: `'#'; s :] -> do { spaces_tabs s; linenum bp s }
| [: `('A'..'Z' | '\192'..'\214' | '\216'..'\222' as c); s :] ->
let id = get_buff (ident (store 0 c) s) in
let loc = (bp, Stream.count s) in
--- 127,133 ----
[ [: `' ' | '\010' | '\013' | '\t' | '\026' | '\012'; s :] ->
next_token s
| [: `'('; s :] -> left_paren bp s
! | [: `'#'; s :] -> sharp bp s
| [: `('A'..'Z' | '\192'..'\214' | '\216'..'\222' as c); s :] ->
let id = get_buff (ident (store 0 c) s) in
let loc = (bp, Stream.count s) in
***************
*** 327,332 ****
--- 327,340 ----
parser
[ [: `'>' :] -> len
| [: a = quotation bp (store len '>') :] -> a ]
+ and sharp bp =
+ parser
+ [ [: `'#'; _ = one_line_comment bp ; a = next_token :] -> a
+ | [: s :] -> do { spaces_tabs s; linenum bp s } ]
+ and one_line_comment bp =
+ parser
+ [ [: `'\n' :] -> ()
+ | [: `_; s :] -> one_line_comment bp s ]
and left_paren bp =
parser
[ [: `'*'; _ = comment bp; a = next_token :] -> a
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
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
0 siblings, 1 reply; 38+ messages in thread
From: cashin @ 2003-04-10 2:59 UTC (permalink / raw)
To: Ocaml Mailing List
Brian Hurt <brian.hurt@qlogic.com> writes:
> On Tue, 8 Apr 2003, Daniel Andor wrote:
>
>> On Tuesday 08 April 2003 8:04 pm, Brian Hurt wrote:
>> > If we're going to be introducing gratuitous backwards incompatiblities,
>> > can we please do it for something usefull? Like say replacing begin/end
>> > with { and }.
>>
>> If I may be a beginner here: how does "begin ... end" differ from "( ... )"?
>> In practice I've found them to be interchangable, but that could just be an
>> accident.
>
> At the linguistic level, not at all. At the text editor level, it's
> easier in vi to jump to match braces than matching begin/ends.
And my ocaml-mode in emacs gets confused about indenting if I use
begin ... end.
--
--Ed L Cashin | PGP public key:
ecashin@uga.edu | http://noserose.net/e/pgp/
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Caml-list] { ... } vs ( ... ) vs begin ... end
2003-04-10 2:59 ` cashin
@ 2003-04-10 7:58 ` Frederic van der Plancke
0 siblings, 0 replies; 38+ messages in thread
From: Frederic van der Plancke @ 2003-04-10 7:58 UTC (permalink / raw)
To: caml-list
> Brian Hurt <brian.hurt@qlogic.com> writes:
>
> > On Tue, 8 Apr 2003, Daniel Andor wrote:
> >
> >> On Tuesday 08 April 2003 8:04 pm, Brian Hurt wrote:
> >> > If we're going to be introducing gratuitous backwards incompatiblities,
> >> > can we please do it for something usefull? Like say replacing begin/end
> >> > with { and }.
> >>
> >> If I may be a beginner here: how does "begin ... end" differ from "( ... )"?
> >> In practice I've found them to be interchangable, but that could just be an
> >> accident.
No, that's by design AFAIK. I'm no longer using begin-end, because I like
punctuation to be light on the eye.
> >
> > At the linguistic level, not at all. At the text editor level, it's
> > easier in vi to jump to match braces than matching begin/ends.
You seem to have missed the difference between ( ... ) and { ... }, the
message you answered used the first form.
There's a big problem with introducing { ... } as synonymous for begin-end:
constructs like { a = b } become ambiguous and only the type-checker can
lift the ambiguity.
Frédéric vdP
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-08 14:25 ` Nickolay Semyonov-Kolchin
2003-04-08 16:08 ` Brian Hurt
2003-04-08 17:31 ` Chris Hecker
@ 2003-04-13 14:07 ` John Max Skaller
2 siblings, 0 replies; 38+ messages in thread
From: John Max Skaller @ 2003-04-13 14:07 UTC (permalink / raw)
To: caml-list
C++ has both C multi-line comments /* */
and C++ // single line comments.
Hardly anyone ever uses the multiline comments
by choice (they're required in some places by
coding standards and because some tools recognize them)
except for long descriptive passages.
// comments are now standard in C99.
--
John Max Skaller, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
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 22:40 ` Joshua Scholar
@ 2003-04-13 19:46 ` Andreas Rossberg
2003-04-13 22:57 ` Daniel M. Albro
2 siblings, 1 reply; 38+ messages in thread
From: Andreas Rossberg @ 2003-04-13 19:46 UTC (permalink / raw)
To: Daniel M. Albro, caml-list
Daniel M. Albro <albro@humnet.ucla.edu> wrote:
>
> But ## is so *ugly*! It just doesn't look OCaml-ic, since # is
> already the object-call operator. What other possibilities are there?
> How about %, %%, --, ' ? If "--" isn't used it might be nice.
How about '' (double prime) or ,, (double comma)?
- Andreas
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Caml-list] single-line comment request
2003-04-13 19:46 ` Andreas Rossberg
@ 2003-04-13 22:57 ` Daniel M. Albro
0 siblings, 0 replies; 38+ messages in thread
From: Daniel M. Albro @ 2003-04-13 22:57 UTC (permalink / raw)
To: Andreas Rossberg; +Cc: caml-list
Double comma's not so bad. But it will look awfully German :)
Maybe "<<" for a more French look, but I guess that's probably
taken...
- Dan
On Sun, 2003-04-13 at 12:46, Andreas Rossberg wrote:
> Daniel M. Albro <albro@humnet.ucla.edu> wrote:
> >
> > But ## is so *ugly*! It just doesn't look OCaml-ic, since # is
> > already the object-call operator. What other possibilities are there?
> > How about %, %%, --, ' ? If "--" isn't used it might be nice.
>
> How about '' (double prime) or ,, (double comma)?
>
> - Andreas
--
Daniel M. Albro <albro@humnet.ucla.edu>
-------------------
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
^ permalink raw reply [flat|nested] 38+ messages in thread
end of thread, other threads:[~2003-04-16 16:00 UTC | newest]
Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-08 12:56 [Caml-list] single-line comment request 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
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox