multi line comments in ruby

A

Artur Merke

Hi,

some time (years ;-) ago there was a discussion about multi line comments
in ruby on this list. I didn't follow it completely, just found it in
news.google. There were sth. about 60 postings but AFAIK today (and it is
2 years later!) there is still no other way to make multi line comments
in ruby then the cumbersome

=begin
....
=end

block? Is this right, or have I simply missed something?

IMHO a simple c/c++ style comment

/*
....
*/

is missing in ruby!


Artur

_______________________________________________________________________________
Artur Merke
||| (e-mail address removed)
(O-O)
_____________________________________________.oo0--(_)--0oo.___________________
 
R

Robert Klemme

Artur Merke said:
Hi,

some time (years ;-) ago there was a discussion about multi line comments
in ruby on this list. I didn't follow it completely, just found it in
news.google. There were sth. about 60 postings but AFAIK today (and it is
2 years later!) there is still no other way to make multi line comments
in ruby then the cumbersome

=begin
...
=end

block? Is this right, or have I simply missed something?

IMHO a simple c/c++ style comment

/*
...
*/

is missing in ruby!

Personally I don't miss it since I don't find =begin =end tedious. As far
as I remember there was some problem with the language syntax that
prevented usage of /* */. And, after all: Ruby != C... :)

Regards

robert
 
J

Josef 'Jupp' Schugt

* Artur Merke; Mon, 10 Nov 2003 10:28:17 +0100
some time (years ;-) ago there was a discussion about multi line comments
in ruby on this list. I didn't follow it completely, just found it in
news.google. There were sth. about 60 postings but AFAIK today (and it is
2 years later!) there is still no other way to make multi line comments
in ruby then the cumbersome

=begin
...
=end

Here's an evil hack that you should *not* use:

_=<<_
This
is
a
multiline
pseudo-comment
_


Josef 'Jupp' Schugt
 
R

Robert Klemme

Josef 'Jupp' Schugt said:
* Artur Merke; Mon, 10 Nov 2003 10:28:17 +0100


Here's an evil hack that you should *not* use:

I'm wondering why you present it. Isn't that contradictory?
:)

robert
 
D

Dave Brown

: some time (years ;-) ago there was a discussion about multi line comments
: in ruby on this list. I didn't follow it completely, just found it in
: news.google. There were sth. about 60 postings but AFAIK today (and it is
: 2 years later!) there is still no other way to make multi line comments
: in ruby then the cumbersome
:
: =begin
: ...
: =end
:
: block? Is this right, or have I simply missed something?
:
: IMHO a simple c/c++ style comment
:
: /*
: ...
: */
:
: is missing in ruby!

No great loss. (I know, I know, I sound like one of those
annoying people who say "no, you don't NEED features and
functionality!", but bear with me here.)

If you ever go through lots of C code, you'll probably notice that
most multiline comments--at least those written in code by good
programmers who have to work with other people--you'll probably
notice this:

/* Multiline comments have a row of stars down the left hand side
* of the comment block so that the comment stands out from the
* rest of the code. Heck, my text editor (vim) automatically put
* these stars in for me.
*/

I have a sneaky feeling that "use a text editor that cooperates
with you" addresses another issue that you'd have with the lack of
multi-line comments--it's harder to type them in and reformat them
when you have to keep worrying about the '#' marks everywhere.
Fear not! A decent code editor will worry about that for you.
Also, it's nice to have an easy way to do one-liner comments;
witness the fact that C++'s "//" is now a standard comment
character in the C99 standard.

At least it's not a capital C in the first column.

Now, because Matz provides features (and you use them), you do
still have =begin/=end, but I usually use those for embedded-
documentation things rather than for comments. Personally, I
prefer to have comments that are obviously comments, even when I'm
not using a syntax-highlighting editor. Perhaps your text editor
is cooperating too well with you? :)

--Dave
 
J

Josef 'Jupp' SCHUGT

Hi!

* Robert Klemme; 2003-11-17, 14:18 UTC:
I'm wondering why you present it.

Because it exists.
Isn't that contradictory?

No, I say one should not use it as in 'refrain from using it unless
you precisely know what you are doing' (the RFC SHOULD that is :).

Josef 'Jupp' Schugt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top