[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

multi line comments in ruby

Artur Merke

11/10/2003 9:28:00 AM

5 Answers

Robert Klemme

11/10/2003 11:32:00 AM

0


"Artur Merke" <merke@ls1.cs.uni-dortmund.de> schrieb im Newsbeitrag
news:Pine.LNX.4.33.0311100952070.17966-100000@as0203.cs.uni-dortmund.de...
> 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

Josef 'Jupp' Schugt

11/10/2003 11:35:00 PM

0

* 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

Robert Klemme

11/11/2003 1:23:00 PM

0


"Josef 'Jupp' Schugt" <jupp@gmx.de> schrieb im Newsbeitrag
news:bop7am$1hbu6a$1@ID-53633.news.uni-berlin.de...
> * 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:

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

robert

dagbrown

11/12/2003 4:37:00 PM

0

In article <Pine.LNX.4.33.0311100952070.17966-100000@as0203.cs.uni-dortmund.de>,
Artur Merke <merke@ls1.cs.uni-dortmund.de> wrote:
: 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!

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

Josef 'Jupp' Schugt

11/17/2003 9:47:00 PM

0

Hi!

* Robert Klemme; 2003-11-17, 14:18 UTC:
> "Josef 'Jupp' Schugt" <jupp@gmx.de> schrieb im Newsbeitrag
> news:bop7am$1hbu6a$1@ID-53633.news.uni-berlin.de...
> > Here's an evil hack that you should *not* use:
>
> 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
--
.-------.
message > 100 kB? / | |
sender = spammer? / | R.I.P.|
text = spam? / ___| |___